Stop tap zones from triggering when scrolling is stopped by tapping (#2680)

This commit is contained in:
NGB-Was-Taken
2025-11-14 12:55:19 +05:45
committed by GitHub
parent c2bc95191b
commit 2ec67ac0c1
3 changed files with 23 additions and 1 deletions

View File

@@ -10,6 +10,10 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
- `Fixed` - for any bug fixes.
- `Other` - for technical stuff.
## [Unreleased]
### Fixed
- Fix reader tap zones triggering after scrolling is stopped by tapping ([@NGB-Was-Taken](https://github.com/NGB-Was-Taken)) ([#2680](https://github.com/mihonapp/mihon/pull/2680))
## [v0.19.3] - 2025-11-07
### Improved
- Improved various aspects of the WebView multi window support ([@TheUnlocked](https://github.com/TheUnlocked)) ([#2662](https://github.com/mihonapp/mihon/pull/2662))

View File

@@ -103,6 +103,7 @@ class WebtoonFrame(context: Context) : FrameLayout(context) {
velocityX: Float,
velocityY: Float,
): Boolean {
recycler?.onManualScroll()
return recycler?.zoomFling(velocityX.toInt(), velocityY.toInt()) ?: false
}
}

View File

@@ -52,6 +52,9 @@ class WebtoonRecyclerView @JvmOverloads constructor(
var tapListener: ((MotionEvent) -> Unit)? = null
var longTapListener: ((MotionEvent) -> Boolean)? = null
private var isManuallyScrolling = false
private var tapDuringManualScroll = false
override fun onMeasure(widthSpec: Int, heightSpec: Int) {
halfWidth = MeasureSpec.getSize(widthSpec) / 2
halfHeight = MeasureSpec.getSize(heightSpec) / 2
@@ -63,6 +66,10 @@ class WebtoonRecyclerView @JvmOverloads constructor(
}
override fun onTouchEvent(e: MotionEvent): Boolean {
if (e.actionMasked == MotionEvent.ACTION_DOWN) {
tapDuringManualScroll = isManuallyScrolling
}
detector.onTouchEvent(e)
return super.onTouchEvent(e)
}
@@ -82,6 +89,10 @@ class WebtoonRecyclerView @JvmOverloads constructor(
val totalItemCount = layoutManager?.itemCount ?: 0
atLastPosition = visibleItemCount > 0 && lastVisibleItemPosition == totalItemCount - 1
atFirstPosition = firstVisibleItemPosition == 0
if (state == SCROLL_STATE_IDLE) {
isManuallyScrolling = false
}
}
private fun getPositionX(positionX: Float): Float {
@@ -212,10 +223,16 @@ class WebtoonRecyclerView @JvmOverloads constructor(
}
}
fun onManualScroll() {
isManuallyScrolling = true
}
inner class GestureListener : GestureDetectorWithLongTap.Listener() {
override fun onSingleTapConfirmed(ev: MotionEvent): Boolean {
if (!tapDuringManualScroll) {
tapListener?.invoke(ev)
}
return false
}