Merge "End current key button animations when the button is hidden" into rvc-qpr-dev

This commit is contained in:
TreeHugger Robot
2020-09-21 21:12:49 +00:00
committed by Android (Google) Code Review
2 changed files with 28 additions and 0 deletions

View File

@@ -171,6 +171,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;

View File

@@ -224,6 +224,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 */);