mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-01 14:04:14 -05:00
Fix crash when tapping reader in long strip mode before RecyclerView is created
This commit is contained in:
parent
bae391c2c1
commit
44cc6f11c7
1 changed files with 5 additions and 1 deletions
|
@ -52,11 +52,15 @@ class WebtoonFrame(context: Context) : FrameLayout(context) {
|
||||||
recycler?.getHitRect(recyclerRect) ?: return super.dispatchTouchEvent(ev)
|
recycler?.getHitRect(recyclerRect) ?: return super.dispatchTouchEvent(ev)
|
||||||
// Shrink the box to account for any rounding issues.
|
// Shrink the box to account for any rounding issues.
|
||||||
recyclerRect.inset(1, 1)
|
recyclerRect.inset(1, 1)
|
||||||
|
|
||||||
|
if (recyclerRect.right < recyclerRect.left || recyclerRect.bottom < recyclerRect.top) {
|
||||||
|
return super.dispatchTouchEvent(ev)
|
||||||
|
}
|
||||||
|
|
||||||
ev.setLocation(
|
ev.setLocation(
|
||||||
ev.x.coerceIn(recyclerRect.left.toFloat(), recyclerRect.right.toFloat()),
|
ev.x.coerceIn(recyclerRect.left.toFloat(), recyclerRect.right.toFloat()),
|
||||||
ev.y.coerceIn(recyclerRect.top.toFloat(), recyclerRect.bottom.toFloat()),
|
ev.y.coerceIn(recyclerRect.top.toFloat(), recyclerRect.bottom.toFloat()),
|
||||||
)
|
)
|
||||||
|
|
||||||
return super.dispatchTouchEvent(ev)
|
return super.dispatchTouchEvent(ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue