summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/LauncherAppWidgetHostView.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/LauncherAppWidgetHostView.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/LauncherAppWidgetHostView.java')
-rw-r--r--src/com/android/launcher3/LauncherAppWidgetHostView.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/com/android/launcher3/LauncherAppWidgetHostView.java b/src/com/android/launcher3/LauncherAppWidgetHostView.java
index 51a649a07..f47fd13ec 100644
--- a/src/com/android/launcher3/LauncherAppWidgetHostView.java
+++ b/src/com/android/launcher3/LauncherAppWidgetHostView.java
@@ -21,6 +21,7 @@ import android.content.Context;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
+import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.widget.RemoteViews;
@@ -36,6 +37,8 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc
private int mPreviousOrientation;
private DragLayer mDragLayer;
+ private float mSlop;
+
public LauncherAppWidgetHostView(Context context) {
super(context);
mContext = context;
@@ -90,6 +93,11 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc
case MotionEvent.ACTION_CANCEL:
mLongPressHelper.cancelLongPress();
break;
+ case MotionEvent.ACTION_MOVE:
+ if (!Utilities.pointInView(this, ev.getX(), ev.getY(), mSlop)) {
+ mLongPressHelper.cancelLongPress();
+ }
+ break;
}
// Otherwise continue letting touch events fall through to children
@@ -104,11 +112,22 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc
case MotionEvent.ACTION_CANCEL:
mLongPressHelper.cancelLongPress();
break;
+ case MotionEvent.ACTION_MOVE:
+ if (!Utilities.pointInView(this, ev.getX(), ev.getY(), mSlop)) {
+ mLongPressHelper.cancelLongPress();
+ }
+ break;
}
return false;
}
@Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ mSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
+ }
+
+ @Override
public void cancelLongPress() {
super.cancelLongPress();
mLongPressHelper.cancelLongPress();