diff --git a/.gitignore b/.gitignore index 174302fc9..cda03a674 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ /.idea/compiler.xml /.idea/workspace.xml /.idea/navEditor.xml +/.idea/ktlint-plugin.xml /.idea/assetWizardSettings.xml /.idea/kotlinScripting.xml /.idea/kotlinc.xml diff --git a/app/build.gradle b/app/build.gradle index b9a115076..373cf3ccd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -82,7 +82,7 @@ afterEvaluate { } dependencies { //noinspection GradleDependency - implementation('com.github.kotatsuapp:kotatsu-parsers:904e0719eb') { + implementation('com.github.KotatsuApp:kotatsu-parsers:a228d71d57') { exclude group: 'org.json', module: 'json' } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/model/Manga.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/model/Manga.kt index 5818fcf28..a7edb01d3 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/model/Manga.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/model/Manga.kt @@ -12,6 +12,7 @@ import org.koitharu.kotatsu.parsers.model.MangaChapter import org.koitharu.kotatsu.parsers.model.MangaSource import org.koitharu.kotatsu.parsers.model.MangaState import org.koitharu.kotatsu.parsers.util.mapToSet +import com.google.android.material.R as materialR @JvmName("mangaIds") fun Collection.ids() = mapToSet { it.id } @@ -42,15 +43,17 @@ val MangaState.titleResId: Int MangaState.FINISHED -> R.string.state_finished MangaState.ABANDONED -> R.string.state_abandoned MangaState.PAUSED -> R.string.state_paused + MangaState.UPCOMING -> R.string.state_upcoming } @get:DrawableRes val MangaState.iconResId: Int get() = when (this) { - MangaState.ONGOING -> R.drawable.ic_state_ongoing + MangaState.ONGOING -> R.drawable.ic_play MangaState.FINISHED -> R.drawable.ic_state_finished MangaState.ABANDONED -> R.drawable.ic_state_abandoned MangaState.PAUSED -> R.drawable.ic_action_pause + MangaState.UPCOMING -> materialR.drawable.ic_clock_black_24dp } fun Manga.findChapter(id: Long): MangaChapter? { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/model/SortOrder.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/model/SortOrder.kt index 71e6034e6..da1f262c8 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/model/SortOrder.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/model/SortOrder.kt @@ -12,4 +12,5 @@ val SortOrder.titleRes: Int SortOrder.RATING -> R.string.by_rating SortOrder.NEWEST -> R.string.newest SortOrder.ALPHABETICAL -> R.string.by_name + SortOrder.ALPHABETICAL_DESC -> R.string.by_name_reverse } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsFragment.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsFragment.kt index 8c6dfce02..9e94f2966 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsFragment.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsFragment.kt @@ -30,6 +30,8 @@ import org.koitharu.kotatsu.bookmarks.domain.Bookmark import org.koitharu.kotatsu.bookmarks.ui.adapter.BookmarksAdapter import org.koitharu.kotatsu.bookmarks.ui.sheet.BookmarksSheet import org.koitharu.kotatsu.core.model.countChaptersByBranch +import org.koitharu.kotatsu.core.model.iconResId +import org.koitharu.kotatsu.core.model.titleResId import org.koitharu.kotatsu.core.ui.BaseFragment import org.koitharu.kotatsu.core.ui.BaseListAdapter import org.koitharu.kotatsu.core.ui.image.CoverSizeResolver @@ -66,7 +68,6 @@ import org.koitharu.kotatsu.list.ui.size.StaticItemSizeResolver import org.koitharu.kotatsu.main.ui.owners.NoModalBottomSheetOwner import org.koitharu.kotatsu.parsers.model.Manga import org.koitharu.kotatsu.parsers.model.MangaSource -import org.koitharu.kotatsu.parsers.model.MangaState import org.koitharu.kotatsu.parsers.model.MangaTag import org.koitharu.kotatsu.reader.ui.ReaderActivity import org.koitharu.kotatsu.scrobbling.common.domain.model.ScrobblingInfo @@ -181,28 +182,13 @@ class DetailsFragment : ratingBar.isVisible = false } - when (manga.state) { - MangaState.FINISHED -> infoLayout.textViewState.apply { - textAndVisible = resources.getString(R.string.state_finished) - drawableTop = ContextCompat.getDrawable(context, R.drawable.ic_state_finished) + infoLayout.textViewState.apply { + manga.state?.let { state -> + textAndVisible = resources.getString(state.titleResId) + drawableTop = ContextCompat.getDrawable(context, state.iconResId) + } ?: run { + isVisible = false } - - MangaState.ONGOING -> infoLayout.textViewState.apply { - textAndVisible = resources.getString(R.string.state_ongoing) - drawableTop = ContextCompat.getDrawable(context, R.drawable.ic_state_ongoing) - } - - MangaState.ABANDONED -> infoLayout.textViewState.apply { - textAndVisible = resources.getString(R.string.state_abandoned) - drawableTop = ContextCompat.getDrawable(context, R.drawable.ic_state_abandoned) - } - - MangaState.PAUSED -> infoLayout.textViewState.apply { - textAndVisible = resources.getString(R.string.state_paused) - drawableTop = ContextCompat.getDrawable(context, R.drawable.ic_action_pause) - } - - null -> infoLayout.textViewState.isVisible = false } if (manga.source == MangaSource.LOCAL) { infoLayout.textViewSource.isVisible = false diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 06d687bf6..e77f2c4da 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -548,4 +548,6 @@ Login to sync account Restore Backup date: %s + Upcoming + Name reversed