diff options
Diffstat (limited to 'src/com/android/launcher3/LauncherAppWidgetHostView.java')
-rw-r--r-- | src/com/android/launcher3/LauncherAppWidgetHostView.java | 19 |
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(); |