From 2e4d57749cbba067738709890bcf6b29a5f41481 Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 23 Feb 2020 16:08:00 -0800 Subject: [PATCH] Fixing reported beta bugs --- app/build.gradle | 2 +- .../data/database/models/Category.kt | 1 + .../tachiyomi/ui/library/LibraryController.kt | 27 ++++++++++--------- .../ui/library/LibraryListController.kt | 2 +- .../tachiyomi/ui/library/LibraryPresenter.kt | 6 ++--- .../tachiyomi/ui/reader/ReaderActivity.kt | 3 +-- .../ui/setting/SettingsGeneralController.kt | 2 +- 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index df3fcf40b5..2d201e1355 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -58,7 +58,7 @@ android { buildTypes { debug { versionNameSuffix "-${getCommitCount()}" - applicationIdSuffix ".debug" + applicationIdSuffix ".debugJ2K" } release { applicationIdSuffix = '.j2k' diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Category.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Category.kt index 883285eff5..eaf2c6cdd7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Category.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Category.kt @@ -94,6 +94,7 @@ interface Category : Serializable { mangaSort?.plus(1) } order = -1 + isFirst = true } } 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 7082a05160..5c75318a1a 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 @@ -362,22 +362,23 @@ open class LibraryController( tabsVisibilityRelay.call(categories.size > 1) - if (freshStart || !justStarted) { - // Delay the scroll position to allow the view to be properly measured. - view.post { - if (isAttached) { - activity?.tabs?.setScrollPosition(library_pager.currentItem, 0f, true) - } - } + libraryMangaRelay.call(LibraryMangaEvent(mangaMap)) - // Send the manga map to child fragments after the adapter is updated. - libraryMangaRelay.call(LibraryMangaEvent(mangaMap)) + view.post { + if (isAttached) { + activity?.tabs?.setScrollPosition(library_pager.currentItem, 0f, true) + } } - else if (!freshStart) { - justStarted = false - if (pager_layout.alpha == 0f) - pager_layout.animate().alpha(1f).setDuration(500).start() + + if (!freshStart && justStarted) { + if (!freshStart) { + justStarted = false + if (pager_layout.alpha == 0f) pager_layout.animate().alpha(1f).setDuration(500).start() + } } + // Delay the scroll position to allow the view to be properly measured. + + // Send the manga map to child fragments after the adapter is updated. } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt index 4aad609b6c..9d3605ebe4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt @@ -235,7 +235,7 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle), updateScroll = false return@IgnoreFirstSpinnerListener } - scrollToHeader(pos - 1) + scrollToHeader(presenter.categories[pos].order) } } 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 aa309e02f4..b789c6a83a 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 @@ -450,12 +450,12 @@ class LibraryPresenter( libraryManga.map { manga -> LibraryItem(manga, libraryLayout, null).apply { unreadType = unreadBadgeType } }.groupBy { - if (showCategories) it.manga.category else 0 + if (showCategories) it.manga.category else -1 } } else { libraryManga.groupBy { manga -> - if (showCategories) manga.category else 0 + if (showCategories) manga.category else -1 //LibraryItem(manga, libraryLayout).apply { unreadType = unreadBadgeType } }.map { entry -> val categoryItem = @@ -467,7 +467,7 @@ class LibraryPresenter( ).apply { unreadType = unreadBadgeType } } }.map { - val cat = if (showCategories) it.firstOrNull()?.manga?.category ?: 0 else 0 + val cat = if (showCategories) it.firstOrNull()?.manga?.category ?: 0 else -1 cat to it //LibraryItem(manga, libraryLayout).apply { unreadType = unreadBadgeType } }.toMap() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index 58515f665f..ae594f5d32 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -42,7 +42,6 @@ import eu.kanade.tachiyomi.ui.reader.viewer.pager.L2RPagerViewer import eu.kanade.tachiyomi.ui.reader.viewer.pager.R2LPagerViewer import eu.kanade.tachiyomi.ui.reader.viewer.pager.VerticalPagerViewer import eu.kanade.tachiyomi.ui.reader.viewer.webtoon.WebtoonViewer -import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate import eu.kanade.tachiyomi.util.lang.plusAssign import eu.kanade.tachiyomi.util.storage.getUriCompat import eu.kanade.tachiyomi.util.system.GLUtil @@ -150,7 +149,7 @@ class ReaderActivity : BaseRxActivity(), override fun onCreate(savedState: Bundle?) { AppCompatDelegate.setDefaultNightMode( when (preferences.theme()) { - 1 -> AppCompatDelegate.MODE_NIGHT_NO + 1, 8 -> AppCompatDelegate.MODE_NIGHT_NO 2, 3, 4 -> AppCompatDelegate.MODE_NIGHT_YES else -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt index c1b7d26a61..97b3eef4a5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt @@ -50,7 +50,7 @@ class SettingsGeneralController : SettingsController() { R.string.system_theme, R.string.sysyem_white_theme, R.string.system_amoled_theme, R.string .system_darkblue_theme) entryValues = listOf(1, 8, 2, 3, 4, 5, 9, 6, 7) - defaultValue = 5 + defaultValue = 8 onChange { activity?.recreate()