Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00262994 authored by Mady Mellor's avatar Mady Mellor Committed by Android (Google) Code Review
Browse files

Merge "Only removeCallbacksAndMessages if the handler exists" into main

parents 777d0484 c246bc9b
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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
            }