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

Commit 76ac1cf8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add a way to disable animations in FastBitmapDrawable" into main

parents ff6fbd89 b4ab76eb
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;