Merge "Ensure that animated key button drawable has callbacks" into rvc-dev am: acf0750084
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12145664 Change-Id: I2269f4bd432e544f46a4bbf30746f1f8f9e758ec
This commit is contained in:
@@ -80,6 +80,22 @@ public class KeyButtonDrawable extends Drawable {
|
||||
private final Paint mShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
|
||||
private final ShadowDrawableState mState;
|
||||
private AnimatedVectorDrawable mAnimatedDrawable;
|
||||
private final Callback mAnimatedDrawableCallback = new Callback() {
|
||||
@Override
|
||||
public void invalidateDrawable(@NonNull Drawable who) {
|
||||
invalidateSelf();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scheduleDrawable(@NonNull Drawable who, @NonNull Runnable what, long when) {
|
||||
scheduleSelf(what, when);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unscheduleDrawable(@NonNull Drawable who, @NonNull Runnable what) {
|
||||
unscheduleSelf(what);
|
||||
}
|
||||
};
|
||||
|
||||
public KeyButtonDrawable(Drawable d, @ColorInt int lightColor, @ColorInt int darkColor,
|
||||
boolean horizontalFlip, Color ovalBackgroundColor) {
|
||||
@@ -97,6 +113,7 @@ public class KeyButtonDrawable extends Drawable {
|
||||
}
|
||||
if (canAnimate()) {
|
||||
mAnimatedDrawable = (AnimatedVectorDrawable) mState.mChildState.newDrawable().mutate();
|
||||
mAnimatedDrawable.setCallback(mAnimatedDrawableCallback);
|
||||
setDrawableBounds(mAnimatedDrawable);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user