Revert "Fix reader tap zones triggering after scrolling was stopped by the user" (#2670)
(cherry picked from commit 412815af067cdf343a6b5c7b5cd38eeb8190d543)
This commit is contained in:
+1
-16
@@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.ui.reader.viewer.webtoon
|
|||||||
|
|
||||||
import android.animation.AnimatorSet
|
import android.animation.AnimatorSet
|
||||||
import android.animation.ValueAnimator
|
import android.animation.ValueAnimator
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.HapticFeedbackConstants
|
import android.view.HapticFeedbackConstants
|
||||||
@@ -35,10 +34,6 @@ class WebtoonRecyclerView @JvmOverloads constructor(
|
|||||||
private var firstVisibleItemPosition = 0
|
private var firstVisibleItemPosition = 0
|
||||||
private var lastVisibleItemPosition = 0
|
private var lastVisibleItemPosition = 0
|
||||||
private var currentScale = DEFAULT_RATE
|
private var currentScale = DEFAULT_RATE
|
||||||
|
|
||||||
private var isManuallyScrolling = false
|
|
||||||
private var hasTappedWhileScrolling = false
|
|
||||||
|
|
||||||
var zoomOutDisabled = false
|
var zoomOutDisabled = false
|
||||||
set(value) {
|
set(value) {
|
||||||
field = value
|
field = value
|
||||||
@@ -67,11 +62,7 @@ class WebtoonRecyclerView @JvmOverloads constructor(
|
|||||||
super.onMeasure(widthSpec, heightSpec)
|
super.onMeasure(widthSpec, heightSpec)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
|
||||||
override fun onTouchEvent(e: MotionEvent): Boolean {
|
override fun onTouchEvent(e: MotionEvent): Boolean {
|
||||||
if (e.actionMasked == MotionEvent.ACTION_DOWN) {
|
|
||||||
hasTappedWhileScrolling = isManuallyScrolling
|
|
||||||
}
|
|
||||||
detector.onTouchEvent(e)
|
detector.onTouchEvent(e)
|
||||||
return super.onTouchEvent(e)
|
return super.onTouchEvent(e)
|
||||||
}
|
}
|
||||||
@@ -91,9 +82,6 @@ class WebtoonRecyclerView @JvmOverloads constructor(
|
|||||||
val totalItemCount = layoutManager?.itemCount ?: 0
|
val totalItemCount = layoutManager?.itemCount ?: 0
|
||||||
atLastPosition = visibleItemCount > 0 && lastVisibleItemPosition == totalItemCount - 1
|
atLastPosition = visibleItemCount > 0 && lastVisibleItemPosition == totalItemCount - 1
|
||||||
atFirstPosition = firstVisibleItemPosition == 0
|
atFirstPosition = firstVisibleItemPosition == 0
|
||||||
if (state == SCROLL_STATE_IDLE) {
|
|
||||||
isManuallyScrolling = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getPositionX(positionX: Float): Float {
|
private fun getPositionX(positionX: Float): Float {
|
||||||
@@ -227,9 +215,7 @@ class WebtoonRecyclerView @JvmOverloads constructor(
|
|||||||
inner class GestureListener : GestureDetectorWithLongTap.Listener() {
|
inner class GestureListener : GestureDetectorWithLongTap.Listener() {
|
||||||
|
|
||||||
override fun onSingleTapConfirmed(ev: MotionEvent): Boolean {
|
override fun onSingleTapConfirmed(ev: MotionEvent): Boolean {
|
||||||
if (!hasTappedWhileScrolling) {
|
tapListener?.invoke(ev)
|
||||||
tapListener?.invoke(ev)
|
|
||||||
}
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,7 +309,6 @@ class WebtoonRecyclerView @JvmOverloads constructor(
|
|||||||
|
|
||||||
if (startScroll) {
|
if (startScroll) {
|
||||||
isZoomDragging = true
|
isZoomDragging = true
|
||||||
isManuallyScrolling = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user