Jump to chapters list earlier on to avoid jank
This commit is contained in:
parent
ec6dba12bd
commit
a1917b8c81
@ -72,8 +72,6 @@ class MangaInfoChaptersController(private val fromSource: Boolean = false) :
|
|||||||
private var chaptersHeaderAdapter: MangaChaptersHeaderAdapter? = null
|
private var chaptersHeaderAdapter: MangaChaptersHeaderAdapter? = null
|
||||||
private var chaptersAdapter: ChaptersAdapter? = null
|
private var chaptersAdapter: ChaptersAdapter? = null
|
||||||
|
|
||||||
private var skippedInfoOnOpen: Boolean = false
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action mode for multiple selection.
|
* Action mode for multiple selection.
|
||||||
*/
|
*/
|
||||||
@ -123,6 +121,13 @@ class MangaInfoChaptersController(private val fromSource: Boolean = false) :
|
|||||||
binding.recycler.setHasFixedSize(true)
|
binding.recycler.setHasFixedSize(true)
|
||||||
chaptersAdapter?.fastScroller = binding.fastScroller
|
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()
|
binding.swipeRefresh.refreshes()
|
||||||
.onEach {
|
.onEach {
|
||||||
fetchMangaInfoFromSource(manualFetch = true)
|
fetchMangaInfoFromSource(manualFetch = true)
|
||||||
@ -306,12 +311,6 @@ class MangaInfoChaptersController(private val fromSource: Boolean = false) :
|
|||||||
if (manga.initialized) {
|
if (manga.initialized) {
|
||||||
// Update view.
|
// Update view.
|
||||||
mangaInfoAdapter?.update(manga, source)
|
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 {
|
} else {
|
||||||
// Initialize manga.
|
// Initialize manga.
|
||||||
fetchMangaInfoFromSource()
|
fetchMangaInfoFromSource()
|
||||||
|
Loading…
Reference in New Issue
Block a user