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

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

Merge "Refactor StylusEventHelper to provide onButtonPress/Release methods"...

Merge "Refactor StylusEventHelper to provide onButtonPress/Release methods" into ub-launcher3-master
parents 04d348aa bb83520a
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -913,11 +913,12 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
        v.setOnLongClickListener(mLongClickListener);

        // Enable stylus button to also trigger long click.
        final StylusEventHelper stylusEventHelper = new StylusEventHelper(v);
        final StylusEventHelper stylusEventHelper =
                new StylusEventHelper(new SimpleOnStylusPressListener(v), v);
        v.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View view, MotionEvent event) {
                return stylusEventHelper.checkAndPerformStylusEvent(event);
                return stylusEventHelper.onMotionEvent(event);
            }
        });
    }
+2 −2
Original line number Diff line number Diff line
@@ -144,7 +144,7 @@ public class BubbleTextView extends TextView
        }

        mLongPressHelper = new CheckLongPressHelper(this);
        mStylusEventHelper = new StylusEventHelper(this);
        mStylusEventHelper = new StylusEventHelper(new SimpleOnStylusPressListener(this), this);

        mOutlineHelper = HolographicOutlineHelper.obtain(getContext());
        if (mCustomShadowsEnabled) {
@@ -270,7 +270,7 @@ public class BubbleTextView extends TextView
        boolean result = super.onTouchEvent(event);

        // Check for a stylus button press, if it occurs cancel any long press checks.
        if (mStylusEventHelper.checkAndPerformStylusEvent(event)) {
        if (mStylusEventHelper.onMotionEvent(event)) {
            mLongPressHelper.cancelLongPress();
            result = true;
        }
+2 −2
Original line number Diff line number Diff line
@@ -277,7 +277,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
        mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap,
                mCountX, mCountY);

        mStylusEventHelper = new StylusEventHelper(this);
        mStylusEventHelper = new StylusEventHelper(new SimpleOnStylusPressListener(this), this);

        mTouchFeedbackView = new ClickShadowView(context);
        addView(mTouchFeedbackView);
@@ -339,7 +339,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
        // enabled to allow rearranging the different home screens. So check what mode
        // the workspace is in, and only perform stylus button presses while in overview mode.
        if (mLauncher.mWorkspace.isInOverviewMode()
                && mStylusEventHelper.checkAndPerformStylusEvent(ev)) {
                && mStylusEventHelper.onMotionEvent(ev)) {
            return true;
        }
        return handled;
+2 −2
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ public class FolderIcon extends FrameLayout implements FolderListener {

    private void init() {
        mLongPressHelper = new CheckLongPressHelper(this);
        mStylusEventHelper = new StylusEventHelper(this);
        mStylusEventHelper = new StylusEventHelper(new SimpleOnStylusPressListener(this), this);
        setAccessibilityDelegate(LauncherAppState.getInstance().getAccessibilityDelegate());
    }

@@ -725,7 +725,7 @@ public class FolderIcon extends FrameLayout implements FolderListener {
        boolean result = super.onTouchEvent(event);

        // Check for a stylus button press, if it occurs cancel any long press checks.
        if (mStylusEventHelper.checkAndPerformStylusEvent(event)) {
        if (mStylusEventHelper.onMotionEvent(event)) {
            mLongPressHelper.cancelLongPress();
            return true;
        }
+2 −2
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc
        super(context);
        mContext = context;
        mLongPressHelper = new CheckLongPressHelper(this);
        mStylusEventHelper = new StylusEventHelper(this);
        mStylusEventHelper = new StylusEventHelper(new SimpleOnStylusPressListener(this), this);
        mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        mDragLayer = ((Launcher) context).getDragLayer();
        setAccessibilityDelegate(LauncherAppState.getInstance().getAccessibilityDelegate());
@@ -94,7 +94,7 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc

        // 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)) {
        if (mStylusEventHelper.onMotionEvent(ev)) {
            mLongPressHelper.cancelLongPress();
            return true;
        }
Loading