-Changing page scroll click regions

-Cleaning up code for page rotations

Change-Id: I046784b108186b6627ce0df3aed57d70c303ef23
This commit is contained in:
Adam Cohen committed 2010-10-07 18:20:49 -07:00
1 parent 00397b1d92
commit 21f12b52a5
2 files changed
+41 -63

No files matched your search

+9 -5
View File
@@ -649,14 +649,14 @@ public abstract class PagedView extends ViewGroup {
// 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 @@ public abstract class PagedView extends ViewGroup {
}
}
protected boolean handlePagingClicks() {
return false;
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (mVelocityTracker == null) {
@@ -835,7 +839,7 @@ public abstract class PagedView extends ViewGroup {
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 @@ public abstract class PagedView extends ViewGroup {
} 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