am 9a088cb8: am c0dfb140: am e33f8259: am 5c6474da: Merge "Fix problem with where PagedView could get stuck (issue 11314889)" into jb-ub-now-jetsonic
* commit '9a088cb860bd79c137f5cdffe696f7645663b654': Fix problem with where PagedView could get stuck (issue 11314889)
This commit is contained in:
@@ -152,6 +152,8 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
|
|||||||
|
|
||||||
protected int mTouchState = TOUCH_STATE_REST;
|
protected int mTouchState = TOUCH_STATE_REST;
|
||||||
protected boolean mForceScreenScrolled = false;
|
protected boolean mForceScreenScrolled = false;
|
||||||
|
private boolean mScrollAbortedFromIntercept = false;
|
||||||
|
|
||||||
|
|
||||||
protected OnLongClickListener mLongClickListener;
|
protected OnLongClickListener mLongClickListener;
|
||||||
|
|
||||||
@@ -1368,6 +1370,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
|
|||||||
final boolean finishedScrolling = (mScroller.isFinished() || xDist < mTouchSlop);
|
final boolean finishedScrolling = (mScroller.isFinished() || xDist < mTouchSlop);
|
||||||
if (finishedScrolling) {
|
if (finishedScrolling) {
|
||||||
mTouchState = TOUCH_STATE_REST;
|
mTouchState = TOUCH_STATE_REST;
|
||||||
|
mScrollAbortedFromIntercept = true;
|
||||||
abortScrollerAnimation(false);
|
abortScrollerAnimation(false);
|
||||||
} else {
|
} else {
|
||||||
if (isTouchPointInViewportWithBuffer((int) mDownMotionX, (int) mDownMotionY)) {
|
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_UP:
|
||||||
case MotionEvent.ACTION_CANCEL:
|
case MotionEvent.ACTION_CANCEL:
|
||||||
|
if (mScrollAbortedFromIntercept) {
|
||||||
|
snapToDestination();
|
||||||
|
}
|
||||||
resetTouchState();
|
resetTouchState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1871,15 +1877,6 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
|
|||||||
snapToPageWithVelocity(finalPage, velocityX);
|
snapToPageWithVelocity(finalPage, velocityX);
|
||||||
} else {
|
} else {
|
||||||
snapToDestination();
|
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 {
|
} else {
|
||||||
if (!mScroller.isFinished()) {
|
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);
|
getScrollY(), vX, 0, Integer.MIN_VALUE, Integer.MAX_VALUE, 0, 0);
|
||||||
invalidate();
|
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) {
|
} else if (mTouchState == TOUCH_STATE_NEXT_PAGE) {
|
||||||
// at this point we have not moved beyond the touch slop
|
// at this point we have not moved beyond the touch slop
|
||||||
// (otherwise mTouchState would be TOUCH_STATE_SCROLLING), so
|
// (otherwise mTouchState would be TOUCH_STATE_SCROLLING), so
|
||||||
@@ -1965,6 +1972,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
|
|||||||
releaseVelocityTracker();
|
releaseVelocityTracker();
|
||||||
endReordering();
|
endReordering();
|
||||||
mCancelTap = false;
|
mCancelTap = false;
|
||||||
|
mScrollAbortedFromIntercept = false;
|
||||||
mTouchState = TOUCH_STATE_REST;
|
mTouchState = TOUCH_STATE_REST;
|
||||||
mActivePointerId = INVALID_POINTER;
|
mActivePointerId = INVALID_POINTER;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user