From 4e922eff9f40d552d5cd651a71113317bb3215ad Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 23 Feb 2020 01:47:05 -0800 Subject: [PATCH] Turns out I don't know how to spell manhwa h before w --- .../eu/kanade/tachiyomi/data/database/models/Manga.kt | 6 +++--- .../kanade/tachiyomi/ui/library/LibraryController.kt | 8 +++++--- .../eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt | 4 ++-- .../ui/library/filter/SortFilterBottomSheet.kt | 10 +++++----- .../eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt | 5 +++-- app/src/main/res/values/strings.xml | 4 ++-- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt index 68cdd1650f..42f76f1558 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt @@ -38,11 +38,11 @@ interface Manga : SManga { return if (currentGenres()?.split(",")?.any { tag -> val trimmedTag = tag.trim().toLowerCase(Locale.US) - trimmedTag == "long strip" || trimmedTag == "manwha" || + trimmedTag == "long strip" || trimmedTag == "manhwa" || trimmedTag.contains("webtoon") } == true || sourceManager.getOrStub(source).name.contains("webtoon", true)) - TYPE_MANWHA + TYPE_MANHWA else TYPE_MANGA } @@ -97,7 +97,7 @@ interface Manga : SManga { const val DISPLAY_MASK = 0x00100000 const val TYPE_MANGA = 1 - const val TYPE_MANWHA = 2 + const val TYPE_MANHWA = 2 fun create(source: Long): Manga = MangaImpl().apply { this.source = source diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt index b534705536..4bf68b158a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt @@ -250,7 +250,7 @@ open class LibraryController( override fun onActivityResumed(activity: Activity) { super.onActivityResumed(activity) - if (observeLater) { + if (observeLater && !::presenter.isInitialized) { presenter.getLibrary() } } @@ -258,11 +258,13 @@ open class LibraryController( override fun onActivityPaused(activity: Activity) { super.onActivityPaused(activity) observeLater = true - presenter.onDestroy() + if (!::presenter.isInitialized) + presenter.onDestroy() } override fun onDestroy() { - presenter.onDestroy() + if (!::presenter.isInitialized) + presenter.onDestroy() super.onDestroy() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt index 6d8e9ddf8c..aa309e02f4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt @@ -170,9 +170,9 @@ class LibraryPresenter( if (filterUnread == STATE_REALLY_EXCLUDE && item.manga.unread > 0) return@f false if (filterMangaType == Manga.TYPE_MANGA && - item.manga.mangaType() == Manga.TYPE_MANWHA) + item.manga.mangaType() == Manga.TYPE_MANHWA) return@f false - if ((filterMangaType == Manga.TYPE_MANWHA) && + if ((filterMangaType == Manga.TYPE_MANHWA) && item.manga.mangaType() == Manga.TYPE_MANGA) return@f false diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/SortFilterBottomSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/SortFilterBottomSheet.kt index 6e5c22c57f..3076dda265 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/SortFilterBottomSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/SortFilterBottomSheet.kt @@ -338,7 +338,7 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A } filter = preferences.filterMangaType().getOrDefault() if (filter > 0) { - filters.add(if (filter == 1) R.string.manga_only else R.string.manwha_only) + filters.add(if (filter == 1) R.string.manga_only else R.string.manhwa_only) } return filters } @@ -365,20 +365,20 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A filter_layout.addView(it) } - checkForManwha() + checkForManhwa() } - private fun checkForManwha() { + private fun checkForManhwa() { GlobalScope.launch(Dispatchers.IO, CoroutineStart.DEFAULT) { val db:DatabaseHelper by injectLazy() val librryManga = db.getLibraryMangas().executeAsBlocking() - if (librryManga.any { it.mangaType() == Manga.TYPE_MANWHA }) { + if (librryManga.any { it.mangaType() == Manga.TYPE_MANHWA }) { launchUI { val mangaType = inflate(R.layout.filter_buttons) as FilterTagGroup mangaType.setup( this@SortFilterBottomSheet, R.string.manga, - R.string.manwha + R.string.manhwa ) this@SortFilterBottomSheet.mangaType = mangaType filter_layout.addView(mangaType) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt index d6c4ea630e..39a8f190eb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt @@ -396,9 +396,10 @@ class ReaderPresenter( val manga = manga ?: return preferences.defaultViewer() if (manga.viewer == -1) { val type = - if (manga.mangaType() == Manga.TYPE_MANWHA) ReaderActivity.WEBTOON + if (manga.mangaType() == Manga.TYPE_MANHWA) ReaderActivity.WEBTOON else 0 - setMangaViewer(type) + manga.viewer = type + db.updateMangaViewer(manga).asRxObservable().subscribe() } return if (manga.viewer == 0) preferences.defaultViewer() else manga.viewer } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6c26267fc7..1e5abe53ca 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -6,7 +6,7 @@ Name Categories Manga - Manwha + Manhwa Chapters Tracking History @@ -47,7 +47,7 @@ Hide categories Hiding categories Manga only - Manwha only + Manhwa only Unlock to access trackers Sorting by %1$s