From b457cdb0c23fdaf0b0d2753dc0b22315e4ed6c20 Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 20 May 2020 22:23:45 -0400 Subject: [PATCH] Scroll up/down when tapping top/bottom quarters of webtoon viewer Includes a fix from J2K: https://github.com/Jays2Kings/tachiyomiJ2K/commit/4e45a337dab08a0fedd3a4b8a5482c221a95956f --- .../kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt | 4 ++-- .../tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt | 7 +++++-- 2 files changed, 7 insertions(+), 4 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 4543cf770f..81ea15a41b 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 @@ -82,8 +82,8 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer { pager.tapListener = { event -> val positionX = event.x when { - positionX < pager.width * 0.33f -> if (config.tappingEnabled) moveLeft() else activity.toggleMenu() - positionX > pager.width * 0.66f -> if (config.tappingEnabled) moveRight() else activity.toggleMenu() + positionX < pager.width * 0.33f && config.tappingEnabled -> moveLeft() + positionX > pager.width * 0.66f && config.tappingEnabled -> moveRight() else -> activity.toggleMenu() } } 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 b98a53c3bb..55791f2446 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 @@ -94,9 +94,12 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr }) recycler.tapListener = { event -> val positionX = event.rawX + val positionY = event.rawY when { - positionX < recycler.width * 0.33 -> if (config.tappingEnabled) scrollUp() else activity.toggleMenu() - positionX > recycler.width * 0.66 -> if (config.tappingEnabled) scrollDown() else activity.toggleMenu() + positionY < recycler.height * 0.25 && config.tappingEnabled -> scrollUp() + positionY > recycler.height * 0.75 && config.tappingEnabled -> scrollDown() + positionX < recycler.width * 0.33 && config.tappingEnabled -> scrollUp() + positionX > recycler.width * 0.66 && config.tappingEnabled -> scrollDown() else -> activity.toggleMenu() } }