diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-09-21 21:12:49 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-09-21 21:12:49 +0000 |
commit | 1989311276e851a2e9c8dadc44481a665b2bf39d (patch) | |
tree | d57b61fccb2210c31f591d404b1a4d3648a1f36f | |
parent | ebdd7d64a98238529106e7fdf635f4f2b36ed302 (diff) | |
parent | 8cbe2db5dd4a3889a2a6a739f34d011b80fbaca8 (diff) |
Merge "End current key button animations when the button is hidden" into rvc-qpr-dev
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java | 18 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonRipple.java | 10 |
2 files changed, 28 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java index 23d03a4b225a..e1ff9a236b02 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java @@ -172,6 +172,24 @@ public class KeyButtonDrawable extends Drawable { } @Override + public boolean setVisible(boolean visible, boolean restart) { + boolean changed = super.setVisible(visible, restart); + if (changed) { + // End any existing animations when the visibility changes + jumpToCurrentState(); + } + return changed; + } + + @Override + public void jumpToCurrentState() { + super.jumpToCurrentState(); + if (mAnimatedDrawable != null) { + mAnimatedDrawable.jumpToCurrentState(); + } + } + + @Override public void setAlpha(int alpha) { mState.mAlpha = alpha; mIconPaint.setAlpha(alpha); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonRipple.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonRipple.java index 2d8784dc41bd..9e1485dba8bd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonRipple.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonRipple.java @@ -225,6 +225,16 @@ public class KeyButtonRipple extends Drawable { } @Override + public boolean setVisible(boolean visible, boolean restart) { + boolean changed = super.setVisible(visible, restart); + if (changed) { + // End any existing animations when the visibility changes + jumpToCurrentState(); + } + return changed; + } + + @Override public void jumpToCurrentState() { endAnimations("jumpToCurrentState", false /* cancel */); } |