am 39665367: Merge change 3317 into donut
Merge commit '3966536766cbe0bd45570c6785e912131911ff79'
* commit '3966536766cbe0bd45570c6785e912131911ff79':
Fixes #1899273.
diff --git a/core/java/android/gesture/GestureOverlayView.java b/core/java/android/gesture/GestureOverlayView.java
index 6f2c2a7..1251964 100755
--- a/core/java/android/gesture/GestureOverlayView.java
+++ b/core/java/android/gesture/GestureOverlayView.java
@@ -93,6 +93,7 @@
private float mTotalLength;
private boolean mIsGesturing = false;
+ private boolean mPreviousWasGesturing = false;
private boolean mInterceptEvents = true;
private boolean mIsListeningForGestures;
@@ -425,6 +426,7 @@
clear(false);
mIsGesturing = false;
+ mPreviousWasGesturing = false;
mStrokeBuffer.clear();
final ArrayList<OnGesturingListener> otherListeners = mOnGesturingListeners;
@@ -442,8 +444,10 @@
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
if (isEnabled()) {
- boolean cancelDispatch = (mIsGesturing || (mCurrentGesture != null &&
- mCurrentGesture.getStrokesCount() > 0)) && mInterceptEvents;
+ final boolean cancelDispatch = (mIsGesturing || (mCurrentGesture != null &&
+ mCurrentGesture.getStrokesCount() > 0 && mPreviousWasGesturing)) &&
+ mInterceptEvents;
+
processEvent(event);
if (cancelDispatch) {
@@ -451,6 +455,7 @@
}
super.dispatchTouchEvent(event);
+
return true;
}
@@ -647,6 +652,7 @@
}
mStrokeBuffer.clear();
+ mPreviousWasGesturing = mIsGesturing;
mIsGesturing = false;
final ArrayList<OnGesturingListener> listeners = mOnGesturingListeners;
@@ -688,6 +694,7 @@
fireOnGesturePerformed();
}
+ mPreviousWasGesturing = false;
mIsFadingOut = false;
mFadingHasStarted = false;
mPath.rewind();
@@ -707,6 +714,7 @@
mFadingHasStarted = false;
mPath.rewind();
mCurrentGesture = null;
+ mPreviousWasGesturing = false;
setPaintAlpha(255);
}
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 14a85f8..f62487f 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -472,7 +472,6 @@
private ViewTreeObserver.OnGlobalLayoutListener mGesturesLayoutListener;
private boolean mGlobalLayoutListenerAddedGestures;
private boolean mInstallGesturesOverlay;
- private boolean mPreviousGesturing;
private boolean mGlobalLayoutListenerAddedFilter;
@@ -737,8 +736,6 @@
mGesturesOverlay.removeAllOnGestureListeners();
mGesturesOverlay.setGestureStrokeType(GestureOverlayView.GESTURE_STROKE_TYPE_MULTIPLE);
mGesturesOverlay.addOnGesturePerformedListener(new GesturesProcessor());
-
- mPreviousGesturing = false;
}
}
@@ -753,25 +750,10 @@
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (mGestures != GESTURES_NONE) {
- if (ev.getAction() != MotionEvent.ACTION_DOWN || mFastScroller == null ||
- !mFastScroller.isPointInside(ev.getX(), ev.getY())) {
-
- if (mGesturesPopup.isShowing()) {
- mGesturesOverlay.dispatchTouchEvent(ev);
-
- final boolean isGesturing = mGesturesOverlay.isGesturing();
-
- if (!isGesturing) {
- mPreviousGesturing = isGesturing;
- return super.dispatchTouchEvent(ev);
- } else if (!mPreviousGesturing){
- mPreviousGesturing = isGesturing;
- final MotionEvent event = MotionEvent.obtain(ev);
- event.setAction(MotionEvent.ACTION_CANCEL);
- super.dispatchTouchEvent(event);
- return true;
- }
- }
+ if ((ev.getAction() != MotionEvent.ACTION_DOWN || mFastScroller == null ||
+ !mFastScroller.isPointInside(ev.getX(), ev.getY())) &&
+ mGesturesPopup.isShowing()) {
+ mGesturesOverlay.dispatchTouchEvent(ev);
}
}