Skip to content
Snippets Groups Projects
Commit c246bc9b authored by Mady Mellor's avatar Mady Mellor
Browse files

Only removeCallbacksAndMessages if the handler exists

Test: none / couldn't repro locally
Bug: 302034566
Change-Id: I3e7af60414c907dcbdb0da241d915a06bf5b1615
parent 5722cd9a
No related branches found
No related tags found
No related merge requests found
......@@ -112,7 +112,7 @@ abstract class RelativeTouchListener : View.OnTouchListener {
viewPositionOnTouchDown.set(v.translationX, v.translationY)
performedLongClick = false
v.handler.postDelayed({
v.handler?.postDelayed({
if (v.isLongClickable) {
performedLongClick = v.performLongClick()
}
......@@ -122,7 +122,7 @@ abstract class RelativeTouchListener : View.OnTouchListener {
MotionEvent.ACTION_MOVE -> {
if (!movedEnough && hypot(dx, dy) > touchSlop && !performedLongClick) {
movedEnough = true
v.handler.removeCallbacksAndMessages(null)
v.handler?.removeCallbacksAndMessages(null)
}
if (movedEnough) {
......@@ -138,7 +138,7 @@ abstract class RelativeTouchListener : View.OnTouchListener {
} else if (!performedLongClick) {
v.performClick()
} else {
v.handler.removeCallbacksAndMessages(null)
v.handler?.removeCallbacksAndMessages(null)
}
velocityTracker.clear()
......@@ -146,7 +146,7 @@ abstract class RelativeTouchListener : View.OnTouchListener {
}
MotionEvent.ACTION_CANCEL -> {
v.handler.removeCallbacksAndMessages(null)
v.handler?.removeCallbacksAndMessages(null)
velocityTracker.clear()
movedEnough = false
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment