diff options
author | Adam Cohen <adamcohen@google.com> | 2013-11-05 00:40:20 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-11-05 00:40:20 +0000 |
commit | 5c6474da600dc828805d86e50ce357bee908131b (patch) | |
tree | 2ece53aea55cd8a890f0e8fc49ac083fc2f1c63f /src/com/android/launcher3/PagedView.java | |
parent | 829f37f3a02a66cd88967cf021e0a96308e49d4b (diff) | |
parent | cae7f573de57a13972a6a215484356f6b4779382 (diff) | |
download | android_packages_apps_Trebuchet-5c6474da600dc828805d86e50ce357bee908131b.tar.gz android_packages_apps_Trebuchet-5c6474da600dc828805d86e50ce357bee908131b.tar.bz2 android_packages_apps_Trebuchet-5c6474da600dc828805d86e50ce357bee908131b.zip |
Merge "Fix problem with where PagedView could get stuck (issue 11314889)" into jb-ub-now-jetsonic
Diffstat (limited to 'src/com/android/launcher3/PagedView.java')
-rw-r--r-- | src/com/android/launcher3/PagedView.java | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java index 46c861b3f..8181bea4f 100644 --- a/src/com/android/launcher3/PagedView.java +++ b/src/com/android/launcher3/PagedView.java @@ -152,6 +152,8 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc protected int mTouchState = TOUCH_STATE_REST; protected boolean mForceScreenScrolled = false; + private boolean mScrollAbortedFromIntercept = false; + protected OnLongClickListener mLongClickListener; @@ -1368,6 +1370,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc final boolean finishedScrolling = (mScroller.isFinished() || xDist < mTouchSlop); if (finishedScrolling) { mTouchState = TOUCH_STATE_REST; + mScrollAbortedFromIntercept = true; abortScrollerAnimation(false); } else { if (isTouchPointInViewportWithBuffer((int) mDownMotionX, (int) mDownMotionY)) { @@ -1395,6 +1398,9 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: + if (mScrollAbortedFromIntercept) { + snapToDestination(); + } resetTouchState(); break; @@ -1871,15 +1877,6 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc snapToPageWithVelocity(finalPage, velocityX); } else { snapToDestination(); - } } else if (mTouchState == TOUCH_STATE_PREV_PAGE) { - // at this point we have not moved beyond the touch slop - // (otherwise mTouchState would be TOUCH_STATE_SCROLLING), so - // we can just page - int nextPage = Math.max(0, mCurrentPage - 1); - if (nextPage != mCurrentPage) { - snapToPage(nextPage); - } else { - snapToDestination(); } } else { if (!mScroller.isFinished()) { @@ -1894,6 +1891,16 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc getScrollY(), vX, 0, Integer.MIN_VALUE, Integer.MAX_VALUE, 0, 0); invalidate(); } + } else if (mTouchState == TOUCH_STATE_PREV_PAGE) { + // at this point we have not moved beyond the touch slop + // (otherwise mTouchState would be TOUCH_STATE_SCROLLING), so + // we can just page + int nextPage = Math.max(0, mCurrentPage - 1); + if (nextPage != mCurrentPage) { + snapToPage(nextPage); + } else { + snapToDestination(); + } } else if (mTouchState == TOUCH_STATE_NEXT_PAGE) { // at this point we have not moved beyond the touch slop // (otherwise mTouchState would be TOUCH_STATE_SCROLLING), so @@ -1965,6 +1972,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc releaseVelocityTracker(); endReordering(); mCancelTap = false; + mScrollAbortedFromIntercept = false; mTouchState = TOUCH_STATE_REST; mActivePointerId = INVALID_POINTER; } |