mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-17 14:59:18 +01:00
Handle last read page being above total page count (fixes #4010)
This commit is contained in:
parent
139a589ad6
commit
141f9b7730
@ -16,6 +16,7 @@ import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
|
|||||||
import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters
|
import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.BaseViewer
|
import eu.kanade.tachiyomi.ui.reader.viewer.BaseViewer
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
import kotlin.math.min
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of a [BaseViewer] to display pages with a [ViewPager].
|
* Implementation of a [BaseViewer] to display pages with a [ViewPager].
|
||||||
@ -239,7 +240,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
|||||||
if (pager.isGone) {
|
if (pager.isGone) {
|
||||||
Timber.d("Pager first layout")
|
Timber.d("Pager first layout")
|
||||||
val pages = chapters.currChapter.pages ?: return
|
val pages = chapters.currChapter.pages ?: return
|
||||||
moveToPage(pages[chapters.currChapter.requestedPage])
|
moveToPage(pages[min(chapters.currChapter.requestedPage, pages.lastIndex)])
|
||||||
pager.isVisible = true
|
pager.isVisible = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
|
|||||||
if (recycler.isGone) {
|
if (recycler.isGone) {
|
||||||
Timber.d("Recycler first layout")
|
Timber.d("Recycler first layout")
|
||||||
val pages = chapters.currChapter.pages ?: return
|
val pages = chapters.currChapter.pages ?: return
|
||||||
moveToPage(pages[chapters.currChapter.requestedPage])
|
moveToPage(pages[min(chapters.currChapter.requestedPage, pages.lastIndex)])
|
||||||
recycler.isVisible = true
|
recycler.isVisible = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user