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

Commit 2adf8902 authored by Alan Viverette's avatar Alan Viverette Committed by Android (Google) Code Review
Browse files

Merge "Prevent re-entry when clearing animating hotspots" into lmp-dev

parents aa2474d5 27cede87
Loading
Loading
Loading
Loading
+20 −14
Original line number Diff line number Diff line
@@ -156,6 +156,12 @@ public class RippleDrawable extends LayerDrawable {
    /** Whether bounds are being overridden. */
    private boolean mOverrideBounds;

    /**
     * Whether hotspots are being cleared. Used to prevent re-entry by
     * animation finish listeners.
     */
    private boolean mClearingHotspots;

    /**
     * Constructor used for drawable inflation.
     */
@@ -524,6 +530,8 @@ public class RippleDrawable extends LayerDrawable {
    }

    private void clearHotspots() {
        mClearingHotspots = true;

        final int count = mAnimatingRipplesCount;
        final Ripple[] ripples = mAnimatingRipples;
        for (int i = 0; i < count; i++) {
@@ -532,11 +540,6 @@ 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) {
@@ -549,6 +552,7 @@ public class RippleDrawable extends LayerDrawable {
            mBackground = null;
        }

        mClearingHotspots = false;
        mAnimatingRipplesCount = 0;
        invalidateSelf();
    }
@@ -647,6 +651,7 @@ public class RippleDrawable extends LayerDrawable {
     * @param ripple the ripple to remove
     */
    void removeRipple(Ripple ripple) {
        if (!mClearingHotspots) {
            // Ripple ripple ripple ripple. Ripple ripple.
            final Ripple[] ripples = mAnimatingRipples;
            final int count = mAnimatingRipplesCount;
@@ -658,6 +663,7 @@ public class RippleDrawable extends LayerDrawable {
                invalidateSelf();
            }
        }
    }

    void removeBackground(RippleBackground background) {
        if (mBackground == background) {