Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5dd1487d authored by Mady Mellor's avatar Mady Mellor Committed by Android (Google) Code Review
Browse files

Merge "Stylus support: handling drag n drop for widgets" into ub-launcher3-burnaby

parents 19b1bad2 770f7c59
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -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: {
                if (!mStylusEventHelper.inStylusButtonPressed()) {
                    mLongPressHelper.postCheckForLongPress();
                }
                mDragLayer.setTouchCompleteListener(this);
                break;
            }