From 23702bfd66db09b1f1348ff26e68974f9e491029 Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Wed, 31 Mar 2021 02:12:37 -0400 Subject: [PATCH] More fixes to the reader nav --- .../java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt | 6 +++++- .../kanade/tachiyomi/ui/reader/ReaderNavGestureDetector.kt | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index 810c456494..f42a9348c3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -23,6 +23,7 @@ import android.widget.SeekBar import androidx.appcompat.app.AppCompatDelegate import androidx.core.graphics.ColorUtils import androidx.core.view.GestureDetectorCompat +import androidx.core.view.isVisible import com.afollestad.materialdialogs.MaterialDialog import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView import com.google.android.material.bottomsheet.BottomSheetBehavior @@ -220,6 +221,9 @@ class ReaderActivity : if (savedInstanceState != null) { menuVisible = savedInstanceState.getBoolean(::menuVisible.name) + binding.readerNav.root.isVisible = menuVisible + } else { + binding.readerNav.root.gone() } binding.chaptersSheet.chaptersBottomSheet.setup(this) @@ -399,7 +403,7 @@ class ReaderActivity : return@setOnTouchListener false } if (it == pageSeekbar) { - readerNavGestureDetector.lockVertical + readerNavGestureDetector.lockVertical || !readerNavGestureDetector.hasScrollHorizontal } else { result } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavGestureDetector.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavGestureDetector.kt index 9968085222..0149dee716 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavGestureDetector.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavGestureDetector.kt @@ -36,7 +36,7 @@ class ReaderNavGestureDetector(private val activity: ReaderActivity) : GestureDe val newDistanceX = (e1?.rawX ?: 0f) - (e2?.rawX ?: 0f) val newDistanceY = (e1?.rawY ?: 0f) - (e2?.rawY ?: 0f) if ((!hasScrollHorizontal || lockVertical) && e2 != null) { - hasScrollHorizontal = abs(newDistanceX) > abs(newDistanceY) && abs(newDistanceX) > 80 + hasScrollHorizontal = abs(newDistanceX) > abs(newDistanceY) && abs(newDistanceX) > 60 val modE = MotionEvent.obtain(e2) modE.setLocation(