diff options
author | Mady Mellor <madym@google.com> | 2015-06-02 15:02:14 -0700 |
---|---|---|
committer | Mady Mellor <madym@google.com> | 2015-06-02 15:02:36 -0700 |
commit | 770f7c590753219d38f957278488b5b3f05e70ec (patch) | |
tree | a5fb8fa119a0a36830ae5ac6e799d1e9c083ff63 /src/com/android/launcher3 | |
parent | 585b764ae24c7869704c428d1739e151e989674d (diff) | |
download | android_packages_apps_Trebuchet-770f7c590753219d38f957278488b5b3f05e70ec.tar.gz android_packages_apps_Trebuchet-770f7c590753219d38f957278488b5b3f05e70ec.tar.bz2 android_packages_apps_Trebuchet-770f7c590753219d38f957278488b5b3f05e70ec.zip |
Stylus support: handling drag n drop for widgets
This alters the widget host view code to consider stylus button presses
allowing the user to pick up widgets with a stylus button press, and drop
them by releasing the button.
Bug: 20430722
Change-Id: I359f72bd80016f4b313aab1325cc92d7c6fd2a8c
Diffstat (limited to 'src/com/android/launcher3')
-rw-r--r-- | src/com/android/launcher3/LauncherAppWidgetHostView.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/com/android/launcher3/LauncherAppWidgetHostView.java b/src/com/android/launcher3/LauncherAppWidgetHostView.java index 71fb2d295..cf461a5b8 100644 --- a/src/com/android/launcher3/LauncherAppWidgetHostView.java +++ b/src/com/android/launcher3/LauncherAppWidgetHostView.java @@ -36,6 +36,7 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc LayoutInflater mInflater; private CheckLongPressHelper mLongPressHelper; + private StylusEventHelper mStylusEventHelper; private Context mContext; private int mPreviousOrientation; private DragLayer mDragLayer; @@ -46,6 +47,7 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc super(context); mContext = context; mLongPressHelper = new CheckLongPressHelper(this); + mStylusEventHelper = new StylusEventHelper(this); mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mDragLayer = ((Launcher) context).getDragLayer(); setAccessibilityDelegate(LauncherAppState.getInstance().getAccessibilityDelegate()); @@ -89,11 +91,17 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc return true; } - // Watch for longpress events at this level to make sure - // users can always pick up this widget + // Watch for longpress or stylus button press events at this level to + // make sure users can always pick up this widget + if (mStylusEventHelper.checkAndPerformStylusEvent(ev)) { + mLongPressHelper.cancelLongPress(); + return true; + } switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: { - mLongPressHelper.postCheckForLongPress(); + if (!mStylusEventHelper.inStylusButtonPressed()) { + mLongPressHelper.postCheckForLongPress(); + } mDragLayer.setTouchCompleteListener(this); break; } |