Fixed double page layout showing pages from other chapters

(cherry picked from commit 8ac340eff0451e59a1fdfeb3577c38db5eb7da00)
This commit is contained in:
Jays2Kings 2021-07-04 17:07:46 -04:00 committed by Jobobby04
parent f9ba8b0072
commit 60f1c6a2b4

View File

@ -231,6 +231,11 @@ class PagerViewerAdapter(private val viewer: PagerViewer) : ViewPagerAdapter() {
// Step 1: segment the pages and transition pages
subItems.forEach {
if (it is ReaderPage) {
if (pagedItems.last().lastOrNull() != null &&
pagedItems.last().last()?.chapter?.chapter?.id != it.chapter.chapter.id
) {
pagedItems.add(mutableListOf())
}
pagedItems.last().add(it)
} else {
otherItems.add(it)