Fix reader menu appearing then disappearing in webtoon viewer when there is no next chapter ()

(cherry picked from commit 6580f5771f634b0e2c25f8cd42fa1596b2ea4e1c)
(cherry picked from commit c0362faaf8965005a04c5fdbf1692865b6a83be4)
This commit is contained in:
CVIUS 2022-05-18 05:20:37 +08:00 committed by Jobobby04
parent b64a2cf816
commit 1c61d37171

@ -104,6 +104,12 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
activity.requestPreloadChapter(firstItem.to) activity.requestPreloadChapter(firstItem.to)
} }
} }
val lastIndex = layoutManager.findLastEndVisibleItemPosition()
val lastItem = adapter.items.getOrNull(lastIndex)
if (lastItem is ChapterTransition.Next && lastItem.to == null) {
activity.showMenu()
}
} }
}, },
) )
@ -223,9 +229,6 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
if (toChapter != null) { if (toChapter != null) {
logcat { "Request preload destination chapter because we're on the transition" } logcat { "Request preload destination chapter because we're on the transition" }
activity.requestPreloadChapter(toChapter) activity.requestPreloadChapter(toChapter)
} else if (transition is ChapterTransition.Next) {
// No more chapters, show menu because the user is probably going to close the reader
activity.showMenu()
} }
} }