Merge "Consume AbsListView touch events following a successful long-press"
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index df84970..7b6fa6d 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -565,6 +565,12 @@
private Runnable mTouchModeReset;
/**
+ * Whether the most recent touch event stream resulted in a successful
+ * long-press action. This is reset on TOUCH_DOWN.
+ */
+ private boolean mHasPerformedLongPress;
+
+ /**
* This view is in transcript mode -- it shows the bottom of the list when the data
* changes
*/
@@ -3108,7 +3114,9 @@
handled = performLongPress(child, longPressPosition, longPressId);
}
}
+
if (handled) {
+ mHasPerformedLongPress = true;
mTouchMode = TOUCH_MODE_REST;
setPressed(false);
child.setPressed(false);
@@ -3811,6 +3819,7 @@
}
private void onTouchDown(MotionEvent ev) {
+ mHasPerformedLongPress = false;
mActivePointerId = ev.getPointerId(0);
if (mTouchMode == TOUCH_MODE_OVERFLING) {
@@ -3874,6 +3883,11 @@
}
private void onTouchMove(MotionEvent ev, MotionEvent vtev) {
+ if (mHasPerformedLongPress) {
+ // Consume all move events following a successful long press.
+ return;
+ }
+
int pointerIndex = ev.findPointerIndex(mActivePointerId);
if (pointerIndex == -1) {
pointerIndex = 0;