From 9db81a5a49ff6679cbc5d20c6a0c523a11691ee5 Mon Sep 17 00:00:00 2001 From: Andreas E Date: Fri, 8 Jan 2021 01:05:38 +0100 Subject: [PATCH] Fix navigation from feedback (#4238) * Fix navigation from feedback (fixes #4237) * Add additional enum values to NavigationRegion mainly for PagerViewer Co-authored-by: arkon --- .../tachiyomi/ui/reader/viewer/ViewerNavigation.kt | 2 +- .../ui/reader/viewer/navigation/LNavigation.kt | 14 +++++++------- .../reader/viewer/pager/PagerDefaultNavigation.kt | 8 ++++---- .../ui/reader/viewer/pager/PagerViewer.kt | 10 ++++++---- .../ui/reader/viewer/webtoon/WebtoonViewer.kt | 8 ++++---- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ViewerNavigation.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ViewerNavigation.kt index ab2714dc3..c46035c53 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ViewerNavigation.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ViewerNavigation.kt @@ -8,7 +8,7 @@ import eu.kanade.tachiyomi.util.lang.invert abstract class ViewerNavigation { enum class NavigationRegion { - NEXT, PREV, MENU + NEXT, PREV, MENU, RIGHT, LEFT } data class Region( diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/LNavigation.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/LNavigation.kt index f5e42e381..6d3390818 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/LNavigation.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/LNavigation.kt @@ -6,11 +6,11 @@ import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation /** * Visualization of default state without any inversion * +---+---+---+ - * | N | N | N | P: Previous + * | P | P | P | P: Previous * +---+---+---+ - * | N | M | P | M: Menu + * | P | M | N | M: Menu * +---+---+---+ - * | P | P | P | N: Next + * | N | N | N | N: Next * +---+---+---+ */ open class LNavigation : ViewerNavigation() { @@ -18,19 +18,19 @@ open class LNavigation : ViewerNavigation() { override var regions: List = listOf( Region( rectF = RectF(0f, 0.33f, 0.33f, 0.66f), - type = NavigationRegion.NEXT + type = NavigationRegion.PREV ), Region( rectF = RectF(0f, 0f, 1f, 0.33f), - type = NavigationRegion.NEXT + type = NavigationRegion.PREV ), Region( rectF = RectF(0.66f, 0.33f, 1f, 0.66f), - type = NavigationRegion.PREV + type = NavigationRegion.NEXT ), Region( rectF = RectF(0f, 0.66f, 1f, 1f), - type = NavigationRegion.PREV + type = NavigationRegion.NEXT ) ) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerDefaultNavigation.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerDefaultNavigation.kt index 95bbd40d0..4d25ce815 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerDefaultNavigation.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerDefaultNavigation.kt @@ -7,11 +7,11 @@ import eu.kanade.tachiyomi.ui.reader.viewer.navigation.LNavigation /** * Visualization of default state without any inversion * +---+---+---+ - * | N | M | P | P: Previous + * | N | M | P | P: Move Right * +---+---+---+ * | N | M | P | M: Menu * +---+---+---+ - * | N | M | P | N: Next + * | N | M | P | N: Move Left * +---+---+---+ */ class PagerDefaultNavigation : ViewerNavigation() { @@ -19,11 +19,11 @@ class PagerDefaultNavigation : ViewerNavigation() { override var regions: List = listOf( Region( rectF = RectF(0f, 0f, 0.33f, 1f), - type = NavigationRegion.NEXT + type = NavigationRegion.LEFT ), Region( rectF = RectF(0.66f, 0f, 1f, 1f), - type = NavigationRegion.PREV + type = NavigationRegion.RIGHT ), ) } 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 d6499a350..e8d64446f 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 @@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition import eu.kanade.tachiyomi.ui.reader.model.ReaderPage import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters import eu.kanade.tachiyomi.ui.reader.viewer.BaseViewer -import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation +import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation.NavigationRegion import kotlinx.coroutines.MainScope import kotlinx.coroutines.cancel import timber.log.Timber @@ -97,9 +97,11 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer { val pos = PointF(event.rawX / pager.width, event.rawY / pager.height) val navigator = config.navigator when (navigator.getAction(pos)) { - ViewerNavigation.NavigationRegion.MENU -> activity.toggleMenu() - ViewerNavigation.NavigationRegion.NEXT -> moveToNext() - ViewerNavigation.NavigationRegion.PREV -> moveToPrevious() + NavigationRegion.MENU -> activity.toggleMenu() + NavigationRegion.NEXT -> moveToNext() + NavigationRegion.PREV -> moveToPrevious() + NavigationRegion.RIGHT -> moveRight() + NavigationRegion.LEFT -> moveLeft() } } pager.longTapListener = f@{ 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 30c47e2f4..a132199d5 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 @@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition import eu.kanade.tachiyomi.ui.reader.model.ReaderPage import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters import eu.kanade.tachiyomi.ui.reader.viewer.BaseViewer -import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation +import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation.NavigationRegion import kotlinx.coroutines.MainScope import kotlinx.coroutines.cancel import rx.subscriptions.CompositeSubscription @@ -111,9 +111,9 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr else { val navigator = config.navigator when (navigator.getAction(pos)) { - ViewerNavigation.NavigationRegion.MENU -> activity.toggleMenu() - ViewerNavigation.NavigationRegion.NEXT -> scrollDown() - ViewerNavigation.NavigationRegion.PREV -> scrollUp() + NavigationRegion.MENU -> activity.toggleMenu() + NavigationRegion.NEXT, NavigationRegion.RIGHT -> scrollDown() + NavigationRegion.PREV, NavigationRegion.LEFT -> scrollUp() } } }