From a1917b8c8108a5ba96e0664f9985cb5d50611c3e Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 27 Jun 2020 21:08:43 -0400 Subject: [PATCH] Jump to chapters list earlier on to avoid jank --- .../manga/chapter/MangaInfoChaptersController.kt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/MangaInfoChaptersController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/MangaInfoChaptersController.kt index 8bedcc991f..dd73386646 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/MangaInfoChaptersController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/MangaInfoChaptersController.kt @@ -72,8 +72,6 @@ class MangaInfoChaptersController(private val fromSource: Boolean = false) : private var chaptersHeaderAdapter: MangaChaptersHeaderAdapter? = null private var chaptersAdapter: ChaptersAdapter? = null - private var skippedInfoOnOpen: Boolean = false - /** * Action mode for multiple selection. */ @@ -123,6 +121,13 @@ class MangaInfoChaptersController(private val fromSource: Boolean = false) : binding.recycler.setHasFixedSize(true) chaptersAdapter?.fastScroller = binding.fastScroller + // Skips directly to chapters list if navigated to from the library + binding.recycler.post { + if (!fromSource && preferences.jumpToChapters()) { + (binding.recycler.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(1, 0) + } + } + binding.swipeRefresh.refreshes() .onEach { fetchMangaInfoFromSource(manualFetch = true) @@ -306,12 +311,6 @@ class MangaInfoChaptersController(private val fromSource: Boolean = false) : if (manga.initialized) { // Update view. mangaInfoAdapter?.update(manga, source) - - // Skips directly to chapters list if navigated to from the library - if (!fromSource && !skippedInfoOnOpen && preferences.jumpToChapters()) { - (binding.recycler.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(1, 0) - skippedInfoOnOpen = true - } } else { // Initialize manga. fetchMangaInfoFromSource()