From f74fe7ecbfd3d9822608c65ddb775191e37b5a8a Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Thu, 1 Apr 2021 16:15:33 -0400 Subject: [PATCH] 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 --- .../ui/reader/ReaderNavGestureDetector.kt | 24 ------------------- 1 file changed, 24 deletions(-) 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 85cd945208..b664d98c7a 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 @@ -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() }