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

Commit 19040260 authored by Roman Birg's avatar Roman Birg Committed by Steve Kondik
Browse files

SystemUI: fix nav button ripple getting stuck



Change-Id: I7711df7d919c3c9b76c468d7203649020ce5ee07
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent a1c11e4e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -223,7 +223,7 @@ public class KeyButtonRipple extends Drawable {
        mRunningAnimations.add(scaleAnimator);
    }

    private void exitSoftware() {
    /* package */ void exitSoftware() {
        ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(this, "glowAlpha", mGlowAlpha, 0f);
        alphaAnimator.setInterpolator(mAlphaExitInterpolator);
        alphaAnimator.setDuration(ANIMATION_DURATION_FADE);
+5 −1
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ public class KeyButtonView extends ImageView {
    private boolean mSupportsLongpress = true;
    private AudioManager mAudioManager;
    private Animator mAnimateToQuiescent = new ObjectAnimator();
    private KeyButtonRipple mRipple;

    private PowerManager mPm;
    private boolean mPerformedLongClick;
@@ -102,7 +103,7 @@ public class KeyButtonView extends ImageView {
        setClickable(true);
        mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
        mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
        setBackground(new KeyButtonRipple(context, this));
        setBackground(mRipple = new KeyButtonRipple(context, this));
        mPm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    }

@@ -207,6 +208,9 @@ public class KeyButtonView extends ImageView {
                break;
            case MotionEvent.ACTION_CANCEL:
                setPressed(false);
                // hack to fix ripple getting stuck. exitHardware() starts an animation,
                // but sometimes does not finish it.
                mRipple.exitSoftware();
                if (mCode != 0) {
                    sendEvent(KeyEvent.ACTION_UP, KeyEvent.FLAG_CANCELED);
                }