Fixed double page layout showing pages from other chapters

This commit is contained in:
Jays2Kings 2021-07-04 16:43:07 -04:00
parent 5ce97ee540
commit 8ac340eff0

View File

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