summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/BubbleTextView.java
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2014-04-15 15:23:31 -0400
committerJason Monk <jmonk@google.com>2014-04-22 10:27:01 -0400
commit02dd7aea3d8ac94126a8f8069e6762592ea60326 (patch)
tree6f6a7148844498dd5766e6cfc49db437c5ddd184 /src/com/android/launcher3/BubbleTextView.java
parentf2a791a798ce24d81f3410c83873087690db4ffd (diff)
downloadandroid_packages_apps_Trebuchet-02dd7aea3d8ac94126a8f8069e6762592ea60326.tar.gz
android_packages_apps_Trebuchet-02dd7aea3d8ac94126a8f8069e6762592ea60326.tar.bz2
android_packages_apps_Trebuchet-02dd7aea3d8ac94126a8f8069e6762592ea60326.zip
Fix long press after already moving off icon
When an icon is in the Hotseat and a user drags off from the icon, but continues holding down, the icon gets a long press triggered by the CheckLongPressHelper. To fix this a check has been added on move events to see if the point has moved outside the view and to cancel the long press check callback if it has. Bug: 13569451 Change-Id: Id175cdc220d70b5e9f8e492ed5a3cc7c3f11db10
Diffstat (limited to 'src/com/android/launcher3/BubbleTextView.java')
-rw-r--r--src/com/android/launcher3/BubbleTextView.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index c180d3227..95300c133 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -28,6 +28,7 @@ import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.MotionEvent;
+import android.view.ViewConfiguration;
import android.widget.TextView;
/**
@@ -60,6 +61,8 @@ public class BubbleTextView extends TextView {
private int mPressedOutlineColor;
private int mPressedGlowColor;
+ private float mSlop;
+
private int mTextColor;
private boolean mShadowsEnabled = true;
private boolean mIsTextVisible;
@@ -272,6 +275,11 @@ public class BubbleTextView extends TextView {
mLongPressHelper.cancelLongPress();
break;
+ case MotionEvent.ACTION_MOVE:
+ if (!Utilities.pointInView(this, event.getX(), event.getY(), mSlop)) {
+ mLongPressHelper.cancelLongPress();
+ }
+ break;
}
return result;
}
@@ -356,6 +364,7 @@ public class BubbleTextView extends TextView {
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (mBackground != null) mBackground.setCallback(this);
+ mSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
}
@Override