More fixes to the reader nav

This commit is contained in:
Jays2Kings 2021-03-31 02:12:37 -04:00
parent a6a2ef6399
commit 23702bfd66
2 changed files with 6 additions and 2 deletions

View File

@ -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
}

View File

@ -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(