mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 15:41:52 +01:00
Removing logic for dragging chapter nav with chapter sheet
Swiping up still expands it but trying to expand with it was too hacky and wonky
This commit is contained in:
parent
004b596671
commit
f74fe7ecbf
@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.ui.reader
|
||||
|
||||
import android.view.GestureDetector
|
||||
import android.view.MotionEvent
|
||||
import eu.kanade.tachiyomi.util.system.dpToPx
|
||||
import eu.kanade.tachiyomi.util.view.collapse
|
||||
import eu.kanade.tachiyomi.util.view.expand
|
||||
import kotlin.math.abs
|
||||
@ -10,8 +9,6 @@ import kotlin.math.abs
|
||||
class ReaderNavGestureDetector(private val activity: ReaderActivity) : GestureDetector
|
||||
.SimpleOnGestureListener() {
|
||||
|
||||
private val lastPixel = 0f
|
||||
private var buttonY: Float = 20f.dpToPx
|
||||
var hasScrollHorizontal = false
|
||||
private set
|
||||
var lockVertical = false
|
||||
@ -20,10 +17,6 @@ class ReaderNavGestureDetector(private val activity: ReaderActivity) : GestureDe
|
||||
override fun onDown(e: MotionEvent): Boolean {
|
||||
lockVertical = false
|
||||
hasScrollHorizontal = false
|
||||
val modE = MotionEvent.obtain(e)
|
||||
modE.setLocation(e.x, 56f.dpToPx)
|
||||
activity.binding.chaptersSheet.root.dispatchTouchEvent(modE)
|
||||
modE.recycle()
|
||||
return false
|
||||
}
|
||||
|
||||
@ -37,22 +30,10 @@ class ReaderNavGestureDetector(private val activity: ReaderActivity) : GestureDe
|
||||
val newDistanceY = (e1?.rawY ?: 0f) - (e2?.rawY ?: 0f)
|
||||
if ((!hasScrollHorizontal || lockVertical) && e2 != null) {
|
||||
hasScrollHorizontal = abs(newDistanceX) > abs(newDistanceY) && abs(newDistanceX) > 40
|
||||
|
||||
val modE = MotionEvent.obtain(e2)
|
||||
modE.setLocation(
|
||||
e2.x,
|
||||
buttonY + modE.y +
|
||||
(if (activity.binding.readerNav.root.alpha == 0f) activity.binding.readerNav.root.height.toFloat() else 0f)
|
||||
)
|
||||
activity.binding.chaptersSheet.root.dispatchTouchEvent(modE)
|
||||
modE.recycle()
|
||||
if (!lockVertical) {
|
||||
lockVertical = abs(newDistanceX) < abs(newDistanceY) && abs(newDistanceY) > 150
|
||||
}
|
||||
}
|
||||
if (hasScrollHorizontal) {
|
||||
activity.binding.chaptersSheet.root.sheetBehavior?.collapse()
|
||||
}
|
||||
return !hasScrollHorizontal && lockVertical
|
||||
}
|
||||
|
||||
@ -75,11 +56,6 @@ class ReaderNavGestureDetector(private val activity: ReaderActivity) : GestureDe
|
||||
result = true
|
||||
}
|
||||
|
||||
val modE = MotionEvent.obtain(e2)
|
||||
modE.setLocation(lastPixel, buttonY + modE.y)
|
||||
modE.action = MotionEvent.ACTION_UP
|
||||
activity.binding.chaptersSheet.root.dispatchTouchEvent(modE)
|
||||
modE.recycle()
|
||||
if (!result) {
|
||||
activity.binding.chaptersSheet.root.sheetBehavior?.collapse()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user