summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/PagedView.java
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2011-02-01 21:47:00 -0800
committerAdam Cohen <adamcohen@google.com>2011-02-01 21:47:33 -0800
commitf8d2823d885ba682140aee1ae0504c1c5e67a24b (patch)
tree46307e22f75e0c7eea7bea428cb56461d25cc346 /src/com/android/launcher2/PagedView.java
parentbfadaad3522dc6b1cf3c95c08031ae088a3f610a (diff)
downloadandroid_packages_apps_Trebuchet-f8d2823d885ba682140aee1ae0504c1c5e67a24b.tar.gz
android_packages_apps_Trebuchet-f8d2823d885ba682140aee1ae0504c1c5e67a24b.tar.bz2
android_packages_apps_Trebuchet-f8d2823d885ba682140aee1ae0504c1c5e67a24b.zip
Adding scroll disambiguation between Workspace and AppWidgets
Change-Id: Ia3ff92b74651f9ea250664ec4cbcc0506db522ec
Diffstat (limited to 'src/com/android/launcher2/PagedView.java')
-rw-r--r--src/com/android/launcher2/PagedView.java32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 92b09f470..6138b868f 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -825,11 +825,15 @@ public abstract class PagedView extends ViewGroup {
anim.start();
}
+ protected void determineScrollingStart(MotionEvent ev) {
+ determineScrollingStart(ev, 1.0f);
+ }
+
/*
* Determines if we should change the touch state to start scrolling after the
* user moves their touch point too far.
*/
- protected void determineScrollingStart(MotionEvent ev) {
+ protected void determineScrollingStart(MotionEvent ev, float touchSlopScale) {
/*
* Locally do absolute value. mLastMotionX is set to the y value
* of the down event.
@@ -840,12 +844,12 @@ public abstract class PagedView extends ViewGroup {
final int xDiff = (int) Math.abs(x - mLastMotionX);
final int yDiff = (int) Math.abs(y - mLastMotionY);
- final int touchSlop = mTouchSlop;
+ final int touchSlop = Math.round(touchSlopScale * mTouchSlop);
boolean xPaged = xDiff > mPagingTouchSlop;
boolean xMoved = xDiff > touchSlop;
boolean yMoved = yDiff > touchSlop;
- if (xMoved || yMoved) {
+ if (xMoved || xPaged || yMoved) {
if (mUsePagingTouchSlop ? xPaged : xMoved) {
// Scroll if the user moved far enough along the X axis
mTouchState = TOUCH_STATE_SCROLLING;
@@ -855,15 +859,19 @@ public abstract class PagedView extends ViewGroup {
pageBeginMoving();
}
// Either way, cancel any pending longpress
- if (mAllowLongPress) {
- mAllowLongPress = false;
- // Try canceling the long press. It could also have been scheduled
- // by a distant descendant, so use the mAllowLongPress flag to block
- // everything
- final View currentPage = getPageAt(mCurrentPage);
- if (currentPage != null) {
- currentPage.cancelLongPress();
- }
+ cancelCurrentPageLongPress();
+ }
+ }
+
+ protected void cancelCurrentPageLongPress() {
+ if (mAllowLongPress) {
+ mAllowLongPress = false;
+ // Try canceling the long press. It could also have been scheduled
+ // by a distant descendant, so use the mAllowLongPress flag to block
+ // everything
+ final View currentPage = getPageAt(mCurrentPage);
+ if (currentPage != null) {
+ currentPage.cancelLongPress();
}
}
}