Merge change 3317 into donut

* changes:
  Fixes #1899273.
This commit is contained in:
Android (Google) Code Review
2009-06-05 11:27:52 -07:00
2 changed files with 14 additions and 24 deletions

View File

@@ -93,6 +93,7 @@ public class GestureOverlayView extends FrameLayout {
private float mTotalLength;
private boolean mIsGesturing = false;
private boolean mPreviousWasGesturing = false;
private boolean mInterceptEvents = true;
private boolean mIsListeningForGestures;
@@ -425,6 +426,7 @@ public class GestureOverlayView extends FrameLayout {
clear(false);
mIsGesturing = false;
mPreviousWasGesturing = false;
mStrokeBuffer.clear();
final ArrayList<OnGesturingListener> otherListeners = mOnGesturingListeners;
@@ -442,8 +444,10 @@ public class GestureOverlayView extends FrameLayout {
@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 @@ public class GestureOverlayView extends FrameLayout {
}
super.dispatchTouchEvent(event);
return true;
}
@@ -647,6 +652,7 @@ public class GestureOverlayView extends FrameLayout {
}
mStrokeBuffer.clear();
mPreviousWasGesturing = mIsGesturing;
mIsGesturing = false;
final ArrayList<OnGesturingListener> listeners = mOnGesturingListeners;
@@ -688,6 +694,7 @@ public class GestureOverlayView extends FrameLayout {
fireOnGesturePerformed();
}
mPreviousWasGesturing = false;
mIsFadingOut = false;
mFadingHasStarted = false;
mPath.rewind();
@@ -707,6 +714,7 @@ public class GestureOverlayView extends FrameLayout {
mFadingHasStarted = false;
mPath.rewind();
mCurrentGesture = null;
mPreviousWasGesturing = false;
setPaintAlpha(255);
}

View File

@@ -472,7 +472,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
private ViewTreeObserver.OnGlobalLayoutListener mGesturesLayoutListener;
private boolean mGlobalLayoutListenerAddedGestures;
private boolean mInstallGesturesOverlay;
private boolean mPreviousGesturing;
private boolean mGlobalLayoutListenerAddedFilter;
@@ -737,8 +736,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
mGesturesOverlay.removeAllOnGestureListeners();
mGesturesOverlay.setGestureStrokeType(GestureOverlayView.GESTURE_STROKE_TYPE_MULTIPLE);
mGesturesOverlay.addOnGesturePerformedListener(new GesturesProcessor());
mPreviousGesturing = false;
}
}
@@ -753,25 +750,10 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
@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);
}
}