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

Commit b6417b8b authored by Alan Viverette's avatar Alan Viverette
Browse files

Don't double-cancel the active ripple

BUG: 16651728
Change-Id: Ibe413eabf9644c2ac9a5c8c1418ff996dacf606a
parent f83fdd08
Loading
Loading
Loading
Loading
+15 −10
Original line number Diff line number Diff line
@@ -525,16 +525,6 @@ public class RippleDrawable extends LayerDrawable {
    }

    private void clearHotspots() {
        if (mRipple != null) {
            mRipple.cancel();
            mRipple = null;
        }

        if (mBackground != null) {
            mBackground.cancel();
            mBackground = null;
        }

        final int count = mAnimatingRipplesCount;
        final Ripple[] ripples = mAnimatingRipples;
        for (int i = 0; i < count; i++) {
@@ -543,6 +533,21 @@ public class RippleDrawable extends LayerDrawable {
            final Ripple ripple = ripples[i];
            ripples[i] = null;
            ripple.cancel();

            // The active ripple may also be animating. Don't cancel it twice.
            if (mRipple == ripple) {
                mRipple = null;
            }
        }

        if (mRipple != null) {
            mRipple.cancel();
            mRipple = null;
        }

        if (mBackground != null) {
            mBackground.cancel();
            mBackground = null;
        }

        mAnimatingRipplesCount = 0;