mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-14 05:15:10 +01:00
Start preloading next chapter if within last 3 pages instead of last page
This commit is contained in:
parent
d1b58a9187
commit
8379caa149
@ -144,8 +144,10 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
|||||||
Timber.d("onReaderPageSelected: ${page.number}/${pages.size}")
|
Timber.d("onReaderPageSelected: ${page.number}/${pages.size}")
|
||||||
activity.onPageSelected(page)
|
activity.onPageSelected(page)
|
||||||
|
|
||||||
if (page === pages.last()) {
|
// Preload next chapter once we're within the last 3 pages of the current chapter
|
||||||
Timber.d("Request preload next chapter because we're at the last page")
|
val inPreloadRange = pages.size - page.number < 3
|
||||||
|
if (inPreloadRange) {
|
||||||
|
Timber.d("Request preload next chapter because we're at page ${page.number} of ${pages.size}")
|
||||||
adapter.nextTransition?.to?.let {
|
adapter.nextTransition?.to?.let {
|
||||||
activity.requestPreloadChapter(it)
|
activity.requestPreloadChapter(it)
|
||||||
}
|
}
|
||||||
|
@ -142,9 +142,11 @@ class WebtoonViewer(val activity: ReaderActivity) : BaseViewer {
|
|||||||
Timber.d("onPageSelected: ${page.number}/${pages.size}")
|
Timber.d("onPageSelected: ${page.number}/${pages.size}")
|
||||||
activity.onPageSelected(page)
|
activity.onPageSelected(page)
|
||||||
|
|
||||||
if (page === pages.last()) {
|
// Preload next chapter once we're within the last 3 pages of the current chapter
|
||||||
Timber.d("Request preload next chapter because we're at the last page")
|
val inPreloadRange = pages.size - page.number < 3
|
||||||
val transition = adapter.items.getOrNull(position + 1) as? ChapterTransition.Next
|
if (inPreloadRange) {
|
||||||
|
Timber.d("Request preload next chapter because we're at page ${page.number} of ${pages.size}")
|
||||||
|
val transition = adapter.items.getOrNull(pages.size + 1) as? ChapterTransition.Next
|
||||||
if (transition?.to != null) {
|
if (transition?.to != null) {
|
||||||
activity.requestPreloadChapter(transition.to)
|
activity.requestPreloadChapter(transition.to)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user