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

Commit d4046edc authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Pass through touches in FolderIcon padding area" into...

Merge "Pass through touches in FolderIcon padding area" into ub-launcher3-rvc-qpr-dev am: 1a32f951 am: 18f73dc1

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12195184

Change-Id: Ia60641fdb48c054013fbc137d8ddb8e8ed290fcf
parents 5ab7171b 18f73dc1
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -129,6 +129,8 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel
    private float mDotScale;
    private Animator mDotScaleAnim;

    private Rect mTouchArea = new Rect();

    private final PointF mTranslationForReorderBounce = new PointF(0, 0);
    private final PointF mTranslationForReorderPreview = new PointF(0, 0);
    private float mScaleForReorderBounce = 1f;
@@ -711,6 +713,11 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (event.getAction() == MotionEvent.ACTION_DOWN
                && shouldIgnoreTouchDown(event.getX(), event.getY())) {
            return false;
        }

        // Call the superclass onTouchEvent first, because sometimes it changes the state to
        // isPressed() on an ACTION_UP
        super.onTouchEvent(event);
@@ -719,6 +726,15 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel
        return true;
    }

    /**
     * Returns true if the touch down at the provided position be ignored
     */
    protected boolean shouldIgnoreTouchDown(float x, float y) {
        mTouchArea.set(getPaddingLeft(), getPaddingTop(), getWidth() - getPaddingRight(),
                getHeight() - getPaddingBottom());
        return !mTouchArea.contains((int) x, (int) y);
    }

    @Override
    public void cancelLongPress() {
        super.cancelLongPress();