Merge "Fix ripples not going away" into sc-dev am: 0d5d58a15f

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15002973

Change-Id: Id05f76e154b56fa039e4db66c0a24ceb654a3786
This commit is contained in:
John Reck
2021-06-16 21:55:15 +00:00
committed by Automerger Merge Worker

View File

@@ -221,6 +221,7 @@ public class RippleDrawable extends LayerDrawable {
private boolean mForceSoftware;
// Patterned
private boolean mAddRipple = false;
private float mTargetBackgroundOpacity;
private ValueAnimator mBackgroundAnimation;
private float mBackgroundOpacity;
@@ -716,6 +717,7 @@ public class RippleDrawable extends LayerDrawable {
}
cancelExitingRipples();
exitPatternedAnimation();
}
@Override
@@ -807,7 +809,7 @@ public class RippleDrawable extends LayerDrawable {
}
private void startPatternedAnimation() {
mRippleActive = true;
mAddRipple = true;
invalidateSelf(false);
}
@@ -862,17 +864,17 @@ public class RippleDrawable extends LayerDrawable {
h = bounds.height();
w = bounds.width();
}
boolean shouldAnimate = mRippleActive;
boolean addRipple = mAddRipple;
boolean shouldExit = mExitingAnimation;
mRippleActive = false;
mExitingAnimation = false;
if (mRunningAnimations.size() > 0 && !shouldAnimate) {
mAddRipple = false;
if (mRunningAnimations.size() > 0 && !addRipple) {
// update paint when view is invalidated
getRipplePaint();
}
drawContent(canvas);
drawPatternedBackground(canvas, cx, cy);
if (shouldAnimate && mRunningAnimations.size() <= MAX_RIPPLES) {
if (addRipple && mRunningAnimations.size() <= MAX_RIPPLES) {
RippleAnimationSession.AnimationProperties<Float, Paint> properties =
createAnimationProperties(x, y, cx, cy, w, h);
mRunningAnimations.add(new RippleAnimationSession(properties, !useCanvasProps)