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

Commit 6f6e219d authored by Sunny Goyal's avatar Sunny Goyal Committed by Automerger Merge Worker
Browse files

Merge "Fixing touch events ignored in some cases" into sc-dev am: e0e64b48...

Merge "Fixing touch events ignored in some cases" into sc-dev am: e0e64b48 am: e7f9f3ee am: 6c1f77dd

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

Change-Id: I296e9c1222be2a5827e05a6c3fa44d47a8c43807
parents b8982509 6c1f77dd
Loading
Loading
Loading
Loading
+21 −4
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.quickstep.views;


import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.Utilities.EDGE_NAV_BAR;
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_7;
import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_7;
@@ -67,6 +68,8 @@ public class AllAppsEduView extends AbstractFloatingView {
    private int mWidthPx;
    private int mWidthPx;
    private int mMaxHeightPx;
    private int mMaxHeightPx;


    private boolean mCanInterceptTouch;

    public AllAppsEduView(Context context, AttributeSet attrs) {
    public AllAppsEduView(Context context, AttributeSet attrs) {
        super(context, attrs);
        super(context, attrs);
        mCircle = (GradientDrawable) context.getDrawable(R.drawable.all_apps_edu_circle);
        mCircle = (GradientDrawable) context.getDrawable(R.drawable.all_apps_edu_circle);
@@ -116,16 +119,27 @@ public class AllAppsEduView extends AbstractFloatingView {
        return true;
        return true;
    }
    }



    private boolean shouldInterceptTouch(MotionEvent ev) {
        if (ev.getAction() == MotionEvent.ACTION_DOWN) {
            mCanInterceptTouch = (ev.getEdgeFlags() & EDGE_NAV_BAR) == 0;
        }
        return mCanInterceptTouch;
    }

    @Override
    @Override
    public boolean onControllerTouchEvent(MotionEvent ev) {
    public boolean onControllerTouchEvent(MotionEvent ev) {
        if (shouldInterceptTouch(ev)) {
            mTouchController.onControllerTouchEvent(ev);
            mTouchController.onControllerTouchEvent(ev);
        if (mAnimation != null) {
            updateAnimationOnTouchEvent(ev);
            updateAnimationOnTouchEvent(ev);
        }
        }
        return super.onControllerTouchEvent(ev);
        return true;
    }
    }


    private void updateAnimationOnTouchEvent(MotionEvent ev) {
    private void updateAnimationOnTouchEvent(MotionEvent ev) {
        if (mAnimation == null) {
            return;
        }
        switch (ev.getActionMasked()) {
        switch (ev.getActionMasked()) {
            case MotionEvent.ACTION_DOWN:
            case MotionEvent.ACTION_DOWN:
                mAnimation.pause();
                mAnimation.pause();
@@ -144,7 +158,10 @@ public class AllAppsEduView extends AbstractFloatingView {


    @Override
    @Override
    public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
    public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
        if (shouldInterceptTouch(ev)) {
            mTouchController.onControllerInterceptTouchEvent(ev);
            mTouchController.onControllerInterceptTouchEvent(ev);
            updateAnimationOnTouchEvent(ev);
        }
        return true;
        return true;
    }
    }