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

Commit e783d831 authored by Roman Birg's avatar Roman Birg
Browse files

SystemUI: fix nav button ripple getting stuck



Change-Id: I7711df7d919c3c9b76c468d7203649020ce5ee07
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent d855e463
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -219,7 +219,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
@@ -71,6 +71,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;
@@ -113,7 +114,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);
    }

@@ -210,6 +211,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);
                }