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

Commit 6f65a96c authored by Alan Viverette's avatar Alan Viverette Committed by Android Git Automerger
Browse files

am 81e2f789: Merge "Fixed mutate() for RippleDrawable, ASLD, AVD, fix...

am 81e2f789: Merge "Fixed mutate() for RippleDrawable, ASLD, AVD, fix applyTheme in VD" into lmp-dev

* commit '81e2f789029701b569d3c0deee8bc74fbebab5db':
  Fixed mutate() for RippleDrawable, ASLD, AVD, fix applyTheme in VD
parents c3013256 a0f63c6e
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -492,7 +492,7 @@ public class AnimatedStateListDrawable extends StateListDrawable {


    @Override
    @Override
    public Drawable mutate() {
    public Drawable mutate() {
        if (!mMutated) {
        if (!mMutated && super.mutate() == this) {
            final AnimatedStateListState newState = new AnimatedStateListState(mState, this, null);
            final AnimatedStateListState newState = new AnimatedStateListState(mState, this, null);
            setConstantState(newState);
            setConstantState(newState);
            mMutated = true;
            mMutated = true;
+1 −1
Original line number Original line Diff line number Diff line
@@ -151,7 +151,7 @@ public class AnimatedVectorDrawable extends Drawable implements Animatable {
    @Override
    @Override
    public Drawable mutate() {
    public Drawable mutate() {
        if (!mMutated && super.mutate() == this) {
        if (!mMutated && super.mutate() == this) {
            mAnimatedVectorState = new AnimatedVectorDrawableState(mAnimatedVectorState);
            mAnimatedVectorState.mVectorDrawable.mutate();
            mMutated = true;
            mMutated = true;
        }
        }
        return this;
        return this;
+23 −6
Original line number Original line Diff line number Diff line
@@ -114,7 +114,8 @@ public class RippleDrawable extends LayerDrawable {
    /** Current dirty bounds, union of current and previous drawing bounds. */
    /** Current dirty bounds, union of current and previous drawing bounds. */
    private final Rect mDirtyBounds = new Rect();
    private final Rect mDirtyBounds = new Rect();


    private final RippleState mState;
    /** Mirrors mLayerState with some extra information. */
    private RippleState mState;


    /** The masking layer, e.g. the layer with id R.id.mask. */
    /** The masking layer, e.g. the layer with id R.id.mask. */
    private Drawable mMask;
    private Drawable mMask;
@@ -885,18 +886,34 @@ public class RippleDrawable extends LayerDrawable {
        return mState;
        return mState;
    }
    }


    @Override
    public Drawable mutate() {
        super.mutate();

        // LayerDrawable creates a new state using createConstantState, so
        // this should always be a safe cast.
        mState = (RippleState) mLayerState;
        return this;
    }

    @Override
    RippleState createConstantState(LayerState state, Resources res) {
        return new RippleState(state, this, res);
    }

    static class RippleState extends LayerState {
    static class RippleState extends LayerState {
        int[] mTouchThemeAttrs;
        int[] mTouchThemeAttrs;
        ColorStateList mColor = ColorStateList.valueOf(Color.MAGENTA);
        ColorStateList mColor = ColorStateList.valueOf(Color.MAGENTA);
        int mMaxRadius = RADIUS_AUTO;
        int mMaxRadius = RADIUS_AUTO;


        public RippleState(RippleState orig, RippleDrawable owner, Resources res) {
        public RippleState(LayerState orig, RippleDrawable owner, Resources res) {
            super(orig, owner, res);
            super(orig, owner, res);


            if (orig != null) {
            if (orig != null && orig instanceof RippleState) {
                mTouchThemeAttrs = orig.mTouchThemeAttrs;
                final RippleState origs = (RippleState) orig;
                mColor = orig.mColor;
                mTouchThemeAttrs = origs.mTouchThemeAttrs;
                mMaxRadius = orig.mMaxRadius;
                mColor = origs.mColor;
                mMaxRadius = origs.mMaxRadius;
            }
            }
        }
        }


+22 −9
Original line number Original line Diff line number Diff line
@@ -507,9 +507,10 @@ public class VectorDrawable extends Drawable {
                pathRenderer.getAlpha());
                pathRenderer.getAlpha());
        pathRenderer.setAlpha(alphaInFloat);
        pathRenderer.setAlpha(alphaInFloat);


        pathRenderer.mRootName = a.getString(R.styleable.VectorDrawable_name);
        final String name = a.getString(R.styleable.VectorDrawable_name);
        if (pathRenderer.mRootName != null) {
        if (name != null) {
            pathRenderer.mVGTargetsMap.put(pathRenderer.mRootName, pathRenderer);
            pathRenderer.mRootName = name;
            pathRenderer.mVGTargetsMap.put(name, pathRenderer);
        }
        }
    }
    }


@@ -1313,9 +1314,15 @@ public class VectorDrawable extends Drawable {
            // Account for any configuration changes.
            // Account for any configuration changes.
            mChangingConfigurations |= a.getChangingConfigurations();
            mChangingConfigurations |= a.getChangingConfigurations();


            mPathName = a.getString(R.styleable.VectorDrawableClipPath_name);
            final String pathName = a.getString(R.styleable.VectorDrawableClipPath_name);
            mNodes = PathParser.createNodesFromPathData(a.getString(
            if (pathName != null) {
                    R.styleable.VectorDrawableClipPath_pathData));
                mPathName = pathName;
            }

            final String pathData = a.getString(R.styleable.VectorDrawableClipPath_pathData);
            if (pathData != null) {
                mNodes = PathParser.createNodesFromPathData(pathData);
            }
        }
        }


        @Override
        @Override
@@ -1415,9 +1422,15 @@ public class VectorDrawable extends Drawable {
            // Extract the theme attributes, if any.
            // Extract the theme attributes, if any.
            mThemeAttrs = a.extractThemeAttrs();
            mThemeAttrs = a.extractThemeAttrs();


            mPathName = a.getString(R.styleable.VectorDrawablePath_name);
            final String pathName = a.getString(R.styleable.VectorDrawablePath_name);
            mNodes = PathParser.createNodesFromPathData(a.getString(
            if (pathName != null) {
                    R.styleable.VectorDrawablePath_pathData));
                mPathName = pathName;
            }

            final String pathData = a.getString(R.styleable.VectorDrawablePath_pathData);
            if (pathData != null) {
                mNodes = PathParser.createNodesFromPathData(pathData);
            }


            mFillColor = a.getColor(R.styleable.VectorDrawablePath_fillColor,
            mFillColor = a.getColor(R.styleable.VectorDrawablePath_fillColor,
                    mFillColor);
                    mFillColor);