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
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index c180d32..95300c1 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -28,6 +28,7 @@
import android.util.Log;
import android.util.TypedValue;
import android.view.MotionEvent;
+import android.view.ViewConfiguration;
import android.widget.TextView;
/**
@@ -60,6 +61,8 @@
private int mPressedOutlineColor;
private int mPressedGlowColor;
+ private float mSlop;
+
private int mTextColor;
private boolean mShadowsEnabled = true;
private boolean mIsTextVisible;
@@ -272,6 +275,11 @@
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 @@
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (mBackground != null) mBackground.setCallback(this);
+ mSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
}
@Override