From 2f07f226b8182699884262ac67139454d5b7070d Mon Sep 17 00:00:00 2001 From: Gauthier Date: Fri, 18 Feb 2022 11:09:03 +0800 Subject: [PATCH] Fix "Landscape zoom" and "Navigate to pan" for split images (#6647) * fix: getPageHolder would always return the first split, as they share the same index * split pages have the same number, we need an extra check to know whether we move forward or back --- .../tachiyomi/ui/reader/viewer/pager/PagerViewer.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt index f609f5d171..e165da0338 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt @@ -161,7 +161,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer { private fun getPageHolder(page: ReaderPage): PagerPageHolder? = pager.children .filterIsInstance(PagerPageHolder::class.java) - .firstOrNull { it.item.index == page.index } + .firstOrNull { it.item == page } /** * Called when a new page (either a [ReaderPage] or [ChapterTransition]) is marked as active @@ -171,8 +171,15 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer { if (page != null && currentPage != page) { val allowPreload = checkAllowPreload(page as? ReaderPage) val forward = when { - currentPage is ReaderPage && page is ReaderPage -> - page.number > (currentPage as ReaderPage).number + currentPage is ReaderPage && page is ReaderPage -> { + // if both pages have the same number, it's a split page with an InsertPage + if (page.number == (currentPage as ReaderPage).number) { + // the InsertPage is always the second in the reading direction + page is InsertPage + } else { + page.number > (currentPage as ReaderPage).number + } + } currentPage is ChapterTransition.Prev && page is ReaderPage -> false else -> true