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

Commit 5ef58aff authored by Alan Viverette's avatar Alan Viverette Committed by Android Git Automerger
Browse files

am 7682e039: Merge "Fixes for DrawableContainer, LayerDrawable"

* commit '7682e039':
  Fixes for DrawableContainer, LayerDrawable
parents dadeaa60 7682e039
Loading
Loading
Loading
Loading
+24 −6
Original line number Diff line number Diff line
@@ -50,6 +50,9 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
    private Drawable mCurrDrawable;
    private int mAlpha = 0xFF;

    /** Whether setAlpha() has been called at least once. */
    private boolean mHasAlpha;

    private int mCurIndex = -1;
    private boolean mMutated;

@@ -117,6 +120,8 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {

    @Override
    public void setAlpha(int alpha) {
        mHasAlpha = true;

        if (mAlpha != alpha) {
            mAlpha = alpha;
            if (mCurrDrawable != null) {
@@ -146,8 +151,11 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {

    @Override
    public void setColorFilter(ColorFilter cf) {
        mDrawableContainerState.mHasColorFilter = true;

        if (mDrawableContainerState.mColorFilter != cf) {
            mDrawableContainerState.mColorFilter = cf;

            if (mCurrDrawable != null) {
                mCurrDrawable.mutate().setColorFilter(cf);
            }
@@ -189,11 +197,13 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {

    @Override
    public void setAutoMirrored(boolean mirrored) {
        if (mDrawableContainerState.mAutoMirrored != mirrored) {
            mDrawableContainerState.mAutoMirrored = mirrored;
            if (mCurrDrawable != null) {
                mCurrDrawable.mutate().setAutoMirrored(mDrawableContainerState.mAutoMirrored);
            }
        }
    }

    @Override
    public boolean isAutoMirrored() {
@@ -210,8 +220,10 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
        }
        if (mCurrDrawable != null) {
            mCurrDrawable.jumpToCurrentState();
            if (mHasAlpha) {
                mCurrDrawable.mutate().setAlpha(mAlpha);
            }
        }
        if (mExitAnimationEnd != 0) {
            mExitAnimationEnd = 0;
            changed = true;
@@ -353,12 +365,14 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
                d.mutate();
                if (mDrawableContainerState.mEnterFadeDuration > 0) {
                    mEnterAnimationEnd = now + mDrawableContainerState.mEnterFadeDuration;
                } else {
                } else if (mHasAlpha) {
                    d.setAlpha(mAlpha);
                }
                if (mDrawableContainerState.mHasColorFilter) {
                    d.setColorFilter(mDrawableContainerState.mColorFilter);
                }
                d.setVisible(isVisible(), true);
                d.setDither(mDrawableContainerState.mDither);
                d.setColorFilter(mDrawableContainerState.mColorFilter);
                d.setState(getState());
                d.setLevel(getLevel());
                d.setBounds(getBounds());
@@ -394,6 +408,8 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
    }

    void animate(boolean schedule) {
        mHasAlpha = true;

        final long now = SystemClock.uptimeMillis();
        boolean animating = false;
        if (mCurrDrawable != null) {
@@ -507,6 +523,7 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
        boolean mAutoMirrored;

        ColorFilter mColorFilter;
        boolean mHasColorFilter;

        DrawableContainerState(DrawableContainerState orig, DrawableContainer owner,
                Resources res) {
@@ -529,6 +546,7 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
                mExitFadeDuration = orig.mExitFadeDuration;
                mAutoMirrored = orig.mAutoMirrored;
                mColorFilter = orig.mColorFilter;
                mHasColorFilter = orig.mHasColorFilter;

                // Cloning the following values may require creating futures.
                mConstantPadding = orig.getConstantPadding();
+1 −0
Original line number Diff line number Diff line
@@ -345,6 +345,7 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
        childDrawable.mInsetT = t;
        childDrawable.mInsetR = r;
        childDrawable.mInsetB = b;
        invalidatePadding();
    }

    /**