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

Commit 0fff7819 authored by Alan Viverette's avatar Alan Viverette Committed by Android Git Automerger
Browse files

am 5c7ca487: am 5ad708bb: am a53b5408: am 81e2f789: Merge "Fixed mutate() for...

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

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

    @Override
    public Drawable mutate() {
        if (!mMutated) {
        if (!mMutated && super.mutate() == this) {
            final AnimatedStateListState newState = new AnimatedStateListState(mState, this, null);
            setConstantState(newState);
            mMutated = true;
+1 −1
Original line number Diff line number Diff line
@@ -151,7 +151,7 @@ public class AnimatedVectorDrawable extends Drawable implements Animatable {
    @Override
    public Drawable mutate() {
        if (!mMutated && super.mutate() == this) {
            mAnimatedVectorState = new AnimatedVectorDrawableState(mAnimatedVectorState);
            mAnimatedVectorState.mVectorDrawable.mutate();
            mMutated = true;
        }
        return this;
+23 −6
Original line number Diff line number Diff line
@@ -114,7 +114,8 @@ public class RippleDrawable extends LayerDrawable {
    /** Current dirty bounds, union of current and previous drawing bounds. */
    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. */
    private Drawable mMask;
@@ -885,18 +886,34 @@ public class RippleDrawable extends LayerDrawable {
        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 {
        int[] mTouchThemeAttrs;
        ColorStateList mColor = ColorStateList.valueOf(Color.MAGENTA);
        int mMaxRadius = RADIUS_AUTO;

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

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

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

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

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

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

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

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

            mPathName = a.getString(R.styleable.VectorDrawablePath_name);
            mNodes = PathParser.createNodesFromPathData(a.getString(
                    R.styleable.VectorDrawablePath_pathData));
            final String pathName = a.getString(R.styleable.VectorDrawablePath_name);
            if (pathName != null) {
                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);