summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2015-08-27 20:37:33 (GMT)
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-08-27 20:37:33 (GMT)
commit027d30007d6c4448f3d07ccfb880eb0f25178314 (patch)
tree9aba312bfa4e294fc04fffb0cad5110bd996f826
parent0fd3e545a709902e67dd42440e351a22a6daa48c (diff)
parentec4845b3b19c1496cd67f58f1d027bcd97e1dcb0 (diff)
downloadandroid_packages_apps_Trebuchet-027d30007d6c4448f3d07ccfb880eb0f25178314.zip
android_packages_apps_Trebuchet-027d30007d6c4448f3d07ccfb880eb0f25178314.tar.gz
android_packages_apps_Trebuchet-027d30007d6c4448f3d07ccfb880eb0f25178314.tar.bz2
Merge "Fixing an issue where you would inadvertently start fastscrolling." into ub-launcher3-burnaby
-rw-r--r--src/com/android/launcher3/BaseRecyclerViewFastScrollBar.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/com/android/launcher3/BaseRecyclerViewFastScrollBar.java b/src/com/android/launcher3/BaseRecyclerViewFastScrollBar.java
index f76aed7..fcee7e8 100644
--- a/src/com/android/launcher3/BaseRecyclerViewFastScrollBar.java
+++ b/src/com/android/launcher3/BaseRecyclerViewFastScrollBar.java
@@ -66,6 +66,7 @@ public class BaseRecyclerViewFastScrollBar {
private boolean mIsDragging;
private boolean mIsThumbDetached;
private boolean mCanThumbDetach;
+ private boolean mIgnoreDragGesture;
// This is the offset from the top of the scrollbar when the user first starts touching. To
// prevent jumping, this offset is applied as the user scrolls.
@@ -180,13 +181,15 @@ public class BaseRecyclerViewFastScrollBar {
int y = (int) ev.getY();
switch (action) {
case MotionEvent.ACTION_DOWN:
- if (isNearPoint(downX, downY)) {
+ if (isNearThumb(downX, downY)) {
mTouchOffset = downY - mThumbOffset.y;
}
break;
case MotionEvent.ACTION_MOVE:
- // Check if we should start scrolling
- if (!mIsDragging && isNearPoint(downX, downY) &&
+ // Check if we should start scrolling, but ignore this fastscroll gesture if we have
+ // exceeded some fixed movement
+ mIgnoreDragGesture |= Math.abs(y - downY) > config.getScaledPagingTouchSlop();
+ if (!mIsDragging && !mIgnoreDragGesture && isNearThumb(downX, lastY) &&
Math.abs(y - downY) > config.getScaledTouchSlop()) {
mRv.getParent().requestDisallowInterceptTouchEvent(true);
mIsDragging = true;
@@ -214,6 +217,7 @@ public class BaseRecyclerViewFastScrollBar {
case MotionEvent.ACTION_CANCEL:
mTouchOffset = 0;
mLastTouchY = 0;
+ mIgnoreDragGesture = false;
if (mIsDragging) {
mIsDragging = false;
mPopup.animateVisibility(false);
@@ -287,7 +291,7 @@ public class BaseRecyclerViewFastScrollBar {
/**
* Returns whether the specified points are near the scroll bar bounds.
*/
- private boolean isNearPoint(int x, int y) {
+ private boolean isNearThumb(int x, int y) {
mTmpRect.set(mThumbOffset.x, mThumbOffset.y, mThumbOffset.x + mThumbWidth,
mThumbOffset.y + mThumbHeight);
mTmpRect.inset(mTouchInset, mTouchInset);