summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/PagedView.java
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2013-11-04 14:42:52 -0800
committerDanesh M <daneshm90@gmail.com>2014-06-05 23:45:56 -0700
commit63455c0128a05ab3a9b101418e5bd5c14e6da6ec (patch)
tree8c2e5fba517ff059f2ec33752489fca6f7b27099 /src/com/android/launcher3/PagedView.java
parentb87ac69fdb4fab8135702fd1203e9828d688df3b (diff)
downloadandroid_packages_apps_Trebuchet-63455c0128a05ab3a9b101418e5bd5c14e6da6ec.tar.gz
android_packages_apps_Trebuchet-63455c0128a05ab3a9b101418e5bd5c14e6da6ec.tar.bz2
android_packages_apps_Trebuchet-63455c0128a05ab3a9b101418e5bd5c14e6da6ec.zip
Fix problem with where PagedView could get stuck (issue 11314889)
-> Also a small code cleanup where something was very weird Change-Id: I3612e1de924a83d1a91b752f3b9e1e239a8db0ea
Diffstat (limited to 'src/com/android/launcher3/PagedView.java')
-rw-r--r--src/com/android/launcher3/PagedView.java26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 4cb4c16a8..c476d8a3c 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -150,6 +150,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;
@@ -1469,6 +1471,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)) {
@@ -1496,6 +1499,9 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
+ if (mScrollAbortedFromIntercept) {
+ snapToDestination();
+ }
resetTouchState();
break;
@@ -1968,15 +1974,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()) {
@@ -1991,6 +1988,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
@@ -2062,6 +2069,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
releaseVelocityTracker();
endReordering();
mCancelTap = false;
+ mScrollAbortedFromIntercept = false;
mTouchState = TOUCH_STATE_REST;
mActivePointerId = INVALID_POINTER;
}