Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4ab76eb authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

Add a way to disable animations in FastBitmapDrawable

We're using this drawable in Notifications, but we don't actually need
the animation.

Bug: 409889803
Test: manual
Flag: EXEMPT trivial change
Change-Id: I569c283ecf8b444a359f3f0b20571f3807852640
parent 783e666b
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -64,6 +64,8 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback {

    private static boolean sFlagHoverEnabled = false;

    private boolean mAnimationEnabled = true;

    protected final Paint mPaint = new Paint(Paint.FILTER_BITMAP_FLAG | Paint.ANTI_ALIAS_FLAG);
    public final BitmapInfo mBitmapInfo;

@@ -255,6 +257,10 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback {

    @Override
    protected boolean onStateChange(int[] state) {
        if (!mAnimationEnabled) {
            return false;
        }

        boolean isPressed = false;
        boolean isHovered = false;
        for (int s : state) {
@@ -430,6 +436,14 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback {
        mHoverScaleEnabledForDisplay = hoverScaleEnabledForDisplay;
    }

    public boolean isAnimationEnabled() {
        return mAnimationEnabled;
    }

    public void setAnimationEnabled(boolean animationEnabled) {
        mAnimationEnabled = animationEnabled;
    }

    public static class FastBitmapConstantState extends ConstantState {
        protected final BitmapInfo mBitmapInfo;