From 7c0a17c042f737bb5303e6b1f94baeca47360c5d Mon Sep 17 00:00:00 2001 From: John Reck Date: Thu, 10 Jun 2021 16:42:26 -0400 Subject: [PATCH] Put starting the animation back inside state changed check Only start or stop the ripple if the state changed. Avoids accidentally starting 2 ripples when the overall state set changed but the state_activated specifically did not. Fixes: 188062293 Test: manual Change-Id: If32f1ee5ad3e7294e2e6924b1a4a0e4070c8bcfc --- .../graphics/drawable/RippleDrawable.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/graphics/java/android/graphics/drawable/RippleDrawable.java b/graphics/java/android/graphics/drawable/RippleDrawable.java index 73e65c2ec0505..8392f432847bf 100644 --- a/graphics/java/android/graphics/drawable/RippleDrawable.java +++ b/graphics/java/android/graphics/drawable/RippleDrawable.java @@ -330,18 +330,18 @@ public class RippleDrawable extends LayerDrawable { private void setRippleActive(boolean active) { if (mRippleActive != active) { mRippleActive = active; - } - if (mState.mRippleStyle == STYLE_SOLID) { - if (active) { - tryRippleEnter(); + if (mState.mRippleStyle == STYLE_SOLID) { + if (active) { + tryRippleEnter(); + } else { + tryRippleExit(); + } } else { - tryRippleExit(); - } - } else { - if (active) { - startPatternedAnimation(); - } else { - exitPatternedAnimation(); + if (active) { + startPatternedAnimation(); + } else { + exitPatternedAnimation(); + } } } }