From 6580f5771f634b0e2c25f8cd42fa1596b2ea4e1c Mon Sep 17 00:00:00 2001 From: CVIUS <84634607+CVIUS@users.noreply.github.com> Date: Wed, 18 May 2022 05:20:37 +0800 Subject: [PATCH] Fix reader menu appearing then disappearing in webtoon viewer when there is no next chapter (#7115) --- .../tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt index 3a21049dd..9ec03ea6d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt @@ -103,6 +103,12 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr activity.requestPreloadChapter(firstItem.to) } } + + val lastIndex = layoutManager.findLastEndVisibleItemPosition() + val lastItem = adapter.items.getOrNull(lastIndex) + if (lastItem is ChapterTransition.Next && lastItem.to == null) { + activity.showMenu() + } } }, ) @@ -216,9 +222,6 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr if (toChapter != null) { logcat { "Request preload destination chapter because we're on the transition" } 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() } }