-Changing page scroll click regions
-Cleaning up code for page rotations
Change-Id: I046784b108186b6627ce0df3aed57d70c303ef23
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 578bbcc..2a96736 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -649,14 +649,14 @@
// check if this can be the beginning of a tap on the side of the pages
// to scroll the current page
- if ((mTouchState != TOUCH_STATE_PREV_PAGE) &&
+ if ((mTouchState != TOUCH_STATE_PREV_PAGE) && !handlePagingClicks() &&
(mTouchState != TOUCH_STATE_NEXT_PAGE)) {
if (getChildCount() > 0) {
int width = getMeasuredWidth();
int offset = getRelativeChildOffset(mCurrentPage);
- if (x < offset) {
+ if (x < offset - mPageSpacing) {
mTouchState = TOUCH_STATE_PREV_PAGE;
- } else if (x > (width - offset)) {
+ } else if (x > (width - offset + mPageSpacing)) {
mTouchState = TOUCH_STATE_NEXT_PAGE;
}
}
@@ -741,6 +741,10 @@
}
}
+ protected boolean handlePagingClicks() {
+ return false;
+ }
+
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (mVelocityTracker == null) {
@@ -835,7 +839,7 @@
mVelocityTracker.recycle();
mVelocityTracker = null;
}
- } else if (mTouchState == TOUCH_STATE_PREV_PAGE) {
+ } else if (mTouchState == TOUCH_STATE_PREV_PAGE && !handlePagingClicks()) {
// at this point we have not moved beyond the touch slop
// (otherwise mTouchState would be TOUCH_STATE_SCROLLING), so
// we can just page
@@ -845,7 +849,7 @@
} else {
snapToDestination();
}
- } else if (mTouchState == TOUCH_STATE_NEXT_PAGE) {
+ } else if (mTouchState == TOUCH_STATE_NEXT_PAGE && !handlePagingClicks()) {
// at this point we have not moved beyond the touch slop
// (otherwise mTouchState would be TOUCH_STATE_SCROLLING), so
// we can just page