From b7c2890250ea8ec4244b939c554bfd0a99c9f799 Mon Sep 17 00:00:00 2001 From: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com> Date: Thu, 15 Jul 2021 19:44:53 +0700 Subject: [PATCH] Don't show navigation overlay if tap navigation is disabled (#5534) * Don't show navigation overlay if tap navigation is disabled * Apply feedback --- .../ui/reader/ReaderNavigationOverlayView.kt | 13 +++++-------- .../tachiyomi/ui/reader/viewer/pager/PagerViewer.kt | 2 +- .../ui/reader/viewer/webtoon/WebtoonViewer.kt | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavigationOverlayView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavigationOverlayView.kt index 9b97372b5..eb02bb8fc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavigationOverlayView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavigationOverlayView.kt @@ -19,17 +19,14 @@ class ReaderNavigationOverlayView(context: Context, attributeSet: AttributeSet) private var navigation: ViewerNavigation? = null - fun setNavigation(navigation: ViewerNavigation, showOnStart: Boolean) { - if (!showOnStart && this.navigation == null) { - this.navigation = navigation - isVisible = false - return - } - + fun setNavigation(navigation: ViewerNavigation, tappingEnabled: Boolean, showOnStart: Boolean) { + val firstLaunch = this.navigation == null this.navigation = navigation invalidate() - if (isVisible) return + if (isVisible || (!showOnStart && firstLaunch) || !tappingEnabled) { + return + } viewPropertyAnimator = animate() .alpha(1f) 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 478d7bb42..fc37c3de0 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 @@ -128,7 +128,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer { config.navigationModeChangedListener = { val showOnStart = config.navigationOverlayOnStart || config.forceNavigationOverlay - activity.binding.navigationOverlay.setNavigation(config.navigator, showOnStart) + activity.binding.navigationOverlay.setNavigation(config.navigator, config.tappingEnabled, showOnStart) } } 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 7ea4e4f22..eae4936ee 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 @@ -129,7 +129,7 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr config.navigationModeChangedListener = { val showOnStart = config.navigationOverlayOnStart || config.forceNavigationOverlay - activity.binding.navigationOverlay.setNavigation(config.navigator, showOnStart) + activity.binding.navigationOverlay.setNavigation(config.navigator, config.tappingEnabled, showOnStart) } frame.layoutParams = ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT)