diff options
author | Alan Viverette <alanv@google.com> | 2015-04-02 18:02:03 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-04-02 18:02:04 +0000 |
commit | 0daa5713ee2df841ea22d88a1393ca11e0138621 (patch) | |
tree | c7edb73e7c5ac99785550722ae889d5f8d6b7cf3 /graphics | |
parent | bcfe87f3e05ac65d7ecb7156cd0de580586df5e9 (diff) | |
parent | e0f95f39c5a669a48ee3ebb8dc45bf2d7ee940f1 (diff) | |
download | frameworks_base-0daa5713ee2df841ea22d88a1393ca11e0138621.zip frameworks_base-0daa5713ee2df841ea22d88a1393ca11e0138621.tar.gz frameworks_base-0daa5713ee2df841ea22d88a1393ca11e0138621.tar.bz2 |
Merge "Fix issues with theming of preloaded ColorStateLists"
Diffstat (limited to 'graphics')
13 files changed, 121 insertions, 121 deletions
diff --git a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java index a56e87e..28c26ff 100644 --- a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java +++ b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java @@ -173,7 +173,7 @@ public class AnimatedVectorDrawable extends Drawable implements Animatable { @Override public int getChangingConfigurations() { - return super.getChangingConfigurations() | mAnimatedVectorState.mChangingConfigurations; + return super.getChangingConfigurations() | mAnimatedVectorState.getChangingConfigurations(); } @Override diff --git a/graphics/java/android/graphics/drawable/BitmapDrawable.java b/graphics/java/android/graphics/drawable/BitmapDrawable.java index dc10a81..6fe6b56 100644 --- a/graphics/java/android/graphics/drawable/BitmapDrawable.java +++ b/graphics/java/android/graphics/drawable/BitmapDrawable.java @@ -454,7 +454,7 @@ public class BitmapDrawable extends Drawable { @Override public int getChangingConfigurations() { - return super.getChangingConfigurations() | mBitmapState.mChangingConfigurations; + return super.getChangingConfigurations() | mBitmapState.getChangingConfigurations(); } private boolean needMirroring() { @@ -834,7 +834,7 @@ public class BitmapDrawable extends Drawable { // Apply theme to contained color state list. if (state.mTint != null && state.mTint.canApplyTheme()) { - state.mTint.applyTheme(t); + state.mTint = state.mTint.obtainForTheme(t); } // Update local properties. @@ -882,7 +882,7 @@ public class BitmapDrawable extends Drawable { @Override public final ConstantState getConstantState() { - mBitmapState.mChangingConfigurations = getChangingConfigurations(); + mBitmapState.mChangingConfigurations |= getChangingConfigurations(); return mBitmapState; } @@ -950,7 +950,8 @@ public class BitmapDrawable extends Drawable { @Override public int getChangingConfigurations() { - return mChangingConfigurations; + return mChangingConfigurations + | (mTint != null ? mTint.getChangingConfigurations() : 0); } } diff --git a/graphics/java/android/graphics/drawable/ColorDrawable.java b/graphics/java/android/graphics/drawable/ColorDrawable.java index f75ab36..8e91621 100644 --- a/graphics/java/android/graphics/drawable/ColorDrawable.java +++ b/graphics/java/android/graphics/drawable/ColorDrawable.java @@ -276,7 +276,7 @@ public class ColorDrawable extends Drawable { } if (state.mTint != null && state.mTint.canApplyTheme()) { - state.mTint.applyTheme(t); + state.mTint = state.mTint.obtainForTheme(t); } updateLocalState(t.getResources()); @@ -327,7 +327,8 @@ public class ColorDrawable extends Drawable { @Override public int getChangingConfigurations() { - return mChangingConfigurations; + return mChangingConfigurations + | (mTint != null ? mTint.getChangingConfigurations() : 0); } } diff --git a/graphics/java/android/graphics/drawable/DrawableContainer.java b/graphics/java/android/graphics/drawable/DrawableContainer.java index ddcb48b..b03fe3a 100644 --- a/graphics/java/android/graphics/drawable/DrawableContainer.java +++ b/graphics/java/android/graphics/drawable/DrawableContainer.java @@ -87,8 +87,7 @@ public class DrawableContainer extends Drawable implements Drawable.Callback { @Override public int getChangingConfigurations() { return super.getChangingConfigurations() - | mDrawableContainerState.mChangingConfigurations - | mDrawableContainerState.mChildrenChangingConfigurations; + | mDrawableContainerState.getChangingConfigurations(); } private boolean needsMirroring() { @@ -865,6 +864,9 @@ public class DrawableContainer extends Drawable implements Drawable.Callback { for (int i = 0; i < N; i++) { if (drawables[i] != null && drawables[i].canApplyTheme()) { drawables[i].applyTheme(theme); + + // Update cached mask of child changing configurations. + mChildrenChangingConfigurations |= drawables[i].getChangingConfigurations(); } } } diff --git a/graphics/java/android/graphics/drawable/DrawableWrapper.java b/graphics/java/android/graphics/drawable/DrawableWrapper.java index 1d6c60f..0da4275 100644 --- a/graphics/java/android/graphics/drawable/DrawableWrapper.java +++ b/graphics/java/android/graphics/drawable/DrawableWrapper.java @@ -180,8 +180,7 @@ public abstract class DrawableWrapper extends Drawable implements Drawable.Callb @Override public int getChangingConfigurations() { return super.getChangingConfigurations() - | (mState != null ? mState.mChangingConfigurations : 0) - | mDrawable.getChangingConfigurations(); + | (mState != null ? mState.getChangingConfigurations() : 0); } @Override @@ -433,7 +432,7 @@ public abstract class DrawableWrapper extends Drawable implements Drawable.Callb @Override public int getChangingConfigurations() { - return mChangingConfigurations; + return mChangingConfigurations | mDrawableState.getChangingConfigurations(); } public boolean canConstantState() { diff --git a/graphics/java/android/graphics/drawable/GradientDrawable.java b/graphics/java/android/graphics/drawable/GradientDrawable.java index eff152c..4c2817c 100644 --- a/graphics/java/android/graphics/drawable/GradientDrawable.java +++ b/graphics/java/android/graphics/drawable/GradientDrawable.java @@ -491,19 +491,21 @@ public class GradientDrawable extends Drawable { } /** - * <p>Sets the colors used to draw the gradient. Each color is specified as an - * ARGB integer and the array must contain at least 2 colors.</p> - * <p><strong>Note</strong>: changing colors will affect all instances - * of a drawable loaded from a resource. It is recommended to invoke - * {@link #mutate()} before changing the colors.</p> - * - * @param colors 2 or more ARGB colors + * Sets the colors used to draw the gradient. + * <p> + * Each color is specified as an ARGB integer and the array must contain at + * least 2 colors. + * <p> + * <strong>Note</strong>: changing colors will affect all instances of a + * drawable loaded from a resource. It is recommended to invoke + * {@link #mutate()} before changing the colors. * + * @param colors an array containing 2 or more ARGB colors * @see #mutate() * @see #setColor(int) */ public void setColors(@ColorInt int[] colors) { - mGradientState.setColors(colors); + mGradientState.setGradientColors(colors); mGradientIsDirty = true; invalidateSelf(); } @@ -568,7 +570,7 @@ public class GradientDrawable extends Drawable { mFillPaint.setAlpha(currFillAlpha); mFillPaint.setDither(st.mDither); mFillPaint.setColorFilter(colorFilter); - if (colorFilter != null && st.mColorStateList == null) { + if (colorFilter != null && st.mSolidColors == null) { mFillPaint.setColor(mAlpha << 24); } if (haveStroke) { @@ -715,7 +717,7 @@ public class GradientDrawable extends Drawable { * @see #setColors(int[]) */ public void setColor(@ColorInt int argb) { - mGradientState.setColorStateList(ColorStateList.valueOf(argb)); + mGradientState.setSolidColors(ColorStateList.valueOf(argb)); mFillPaint.setColor(argb); invalidateSelf(); } @@ -734,7 +736,7 @@ public class GradientDrawable extends Drawable { * @see #mutate() */ public void setColor(ColorStateList colorStateList) { - mGradientState.setColorStateList(colorStateList); + mGradientState.setSolidColors(colorStateList); final int color; if (colorStateList == null) { color = Color.TRANSPARENT; @@ -751,9 +753,9 @@ public class GradientDrawable extends Drawable { boolean invalidateSelf = false; final GradientState s = mGradientState; - final ColorStateList stateList = s.mColorStateList; - if (stateList != null) { - final int newColor = stateList.getColorForState(stateSet, 0); + final ColorStateList solidColors = s.mSolidColors; + if (solidColors != null) { + final int newColor = solidColors.getColorForState(stateSet, 0); final int oldColor = mFillPaint.getColor(); if (oldColor != newColor) { mFillPaint.setColor(newColor); @@ -763,12 +765,12 @@ public class GradientDrawable extends Drawable { final Paint strokePaint = mStrokePaint; if (strokePaint != null) { - final ColorStateList strokeStateList = s.mStrokeColorStateList; - if (strokeStateList != null) { - final int newStrokeColor = strokeStateList.getColorForState(stateSet, 0); - final int oldStrokeColor = strokePaint.getColor(); - if (oldStrokeColor != newStrokeColor) { - strokePaint.setColor(newStrokeColor); + final ColorStateList strokeColors = s.mStrokeColors; + if (strokeColors != null) { + final int newColor = strokeColors.getColorForState(stateSet, 0); + final int oldColor = strokePaint.getColor(); + if (oldColor != newColor) { + strokePaint.setColor(newColor); invalidateSelf = true; } } @@ -791,14 +793,14 @@ public class GradientDrawable extends Drawable { public boolean isStateful() { final GradientState s = mGradientState; return super.isStateful() - || (s.mColorStateList != null && s.mColorStateList.isStateful()) - || (s.mStrokeColorStateList != null && s.mStrokeColorStateList.isStateful()) + || (s.mSolidColors != null && s.mSolidColors.isStateful()) + || (s.mStrokeColors != null && s.mStrokeColors.isStateful()) || (s.mTint != null && s.mTint.isStateful()); } @Override public int getChangingConfigurations() { - return super.getChangingConfigurations() | mGradientState.mChangingConfigurations; + return super.getChangingConfigurations() | mGradientState.getChangingConfigurations(); } @Override @@ -899,10 +901,10 @@ public class GradientDrawable extends Drawable { mRect.set(bounds.left + inset, bounds.top + inset, bounds.right - inset, bounds.bottom - inset); - final int[] colors = st.mColors; - if (colors != null) { - RectF r = mRect; - float x0, x1, y0, y1; + final int[] gradientColors = st.mGradientColors; + if (gradientColors != null) { + final RectF r = mRect; + final float x0, x1, y0, y1; if (st.mGradient == LINEAR_GRADIENT) { final float level = st.mUseLevel ? getLevel() / 10000.0f : 1.0f; @@ -942,7 +944,7 @@ public class GradientDrawable extends Drawable { } mFillPaint.setShader(new LinearGradient(x0, y0, x1, y1, - colors, st.mPositions, Shader.TileMode.CLAMP)); + gradientColors, st.mPositions, Shader.TileMode.CLAMP)); } else if (st.mGradient == RADIAL_GRADIENT) { x0 = r.left + (r.right - r.left) * st.mCenterX; y0 = r.top + (r.bottom - r.top) * st.mCenterY; @@ -971,22 +973,22 @@ public class GradientDrawable extends Drawable { } mFillPaint.setShader(new RadialGradient( - x0, y0, radius, colors, null, Shader.TileMode.CLAMP)); + x0, y0, radius, gradientColors, null, Shader.TileMode.CLAMP)); } else if (st.mGradient == SWEEP_GRADIENT) { x0 = r.left + (r.right - r.left) * st.mCenterX; y0 = r.top + (r.bottom - r.top) * st.mCenterY; - int[] tempColors = colors; + int[] tempColors = gradientColors; float[] tempPositions = null; if (st.mUseLevel) { tempColors = st.mTempColors; - final int length = colors.length; + final int length = gradientColors.length; if (tempColors == null || tempColors.length != length + 1) { tempColors = st.mTempColors = new int[length + 1]; } - System.arraycopy(colors, 0, tempColors, 0, length); - tempColors[length] = colors[length - 1]; + System.arraycopy(gradientColors, 0, tempColors, 0, length); + tempColors[length] = gradientColors[length - 1]; tempPositions = st.mTempPositions; final float fraction = 1.0f / (length - 1); @@ -1006,7 +1008,7 @@ public class GradientDrawable extends Drawable { // If we don't have a solid color, the alpha channel must be // maxed out so that alpha modulation works correctly. - if (st.mColorStateList == null) { + if (st.mSolidColors == null) { mFillPaint.setColor(Color.BLACK); } } @@ -1044,15 +1046,15 @@ public class GradientDrawable extends Drawable { } if (state.mTint != null && state.mTint.canApplyTheme()) { - state.mTint.applyTheme(t); + state.mTint = state.mTint.obtainForTheme(t); } - if (state.mColorStateList != null && state.mColorStateList.canApplyTheme()) { - state.mColorStateList.applyTheme(t); + if (state.mSolidColors != null && state.mSolidColors.canApplyTheme()) { + state.mSolidColors = state.mSolidColors.obtainForTheme(t); } - if (state.mStrokeColorStateList != null && state.mStrokeColorStateList.canApplyTheme()) { - state.mStrokeColorStateList.applyTheme(t); + if (state.mStrokeColors != null && state.mStrokeColors.canApplyTheme()) { + state.mStrokeColors = state.mStrokeColors.obtainForTheme(t); } applyThemeChildElements(t); @@ -1288,7 +1290,7 @@ public class GradientDrawable extends Drawable { ColorStateList colorStateList = a.getColorStateList( R.styleable.GradientDrawableStroke_color); if (colorStateList == null) { - colorStateList = st.mStrokeColorStateList; + colorStateList = st.mStrokeColors; } if (dashWidth != 0.0f) { @@ -1346,10 +1348,10 @@ public class GradientDrawable extends Drawable { R.styleable.GradientDrawableGradient_endColor, 0); if (hasCenterColor) { - st.mColors = new int[3]; - st.mColors[0] = startColor; - st.mColors[1] = centerColor; - st.mColors[2] = endColor; + st.mGradientColors = new int[3]; + st.mGradientColors[0] = startColor; + st.mGradientColors[1] = centerColor; + st.mGradientColors[2] = endColor; st.mPositions = new float[3]; st.mPositions[0] = 0.0f; @@ -1357,9 +1359,9 @@ public class GradientDrawable extends Drawable { st.mPositions[1] = st.mCenterX != 0.5f ? st.mCenterX : st.mCenterY; st.mPositions[2] = 1f; } else { - st.mColors = new int[2]; - st.mColors[0] = startColor; - st.mColors[1] = endColor; + st.mGradientColors = new int[2]; + st.mGradientColors[0] = startColor; + st.mGradientColors[1] = endColor; } if (st.mGradient == LINEAR_GRADIENT) { @@ -1552,9 +1554,9 @@ public class GradientDrawable extends Drawable { public int mGradient = LINEAR_GRADIENT; public int mAngle = 0; public Orientation mOrientation; - public ColorStateList mColorStateList; - public ColorStateList mStrokeColorStateList; - public int[] mColors; + public ColorStateList mSolidColors; + public ColorStateList mStrokeColors; + public int[] mGradientColors; public int[] mTempColors; // no need to copy public float[] mTempPositions; // no need to copy public float[] mPositions; @@ -1593,9 +1595,9 @@ public class GradientDrawable extends Drawable { int[] mAttrCorners; int[] mAttrPadding; - public GradientState(Orientation orientation, int[] colors) { + public GradientState(Orientation orientation, int[] gradientColors) { mOrientation = orientation; - setColors(colors); + setGradientColors(gradientColors); } public GradientState(GradientState state) { @@ -1604,14 +1606,14 @@ public class GradientDrawable extends Drawable { mGradient = state.mGradient; mAngle = state.mAngle; mOrientation = state.mOrientation; - mColorStateList = state.mColorStateList; - if (state.mColors != null) { - mColors = state.mColors.clone(); + mSolidColors = state.mSolidColors; + if (state.mGradientColors != null) { + mGradientColors = state.mGradientColors.clone(); } if (state.mPositions != null) { mPositions = state.mPositions.clone(); } - mStrokeColorStateList = state.mStrokeColorStateList; + mStrokeColors = state.mStrokeColors; mStrokeWidth = state.mStrokeWidth; mStrokeDashWidth = state.mStrokeDashWidth; mStrokeDashGap = state.mStrokeDashGap; @@ -1655,8 +1657,8 @@ public class GradientDrawable extends Drawable { || mAttrSolid != null || mAttrStroke != null || mAttrCorners != null || mAttrPadding != null || (mTint != null && mTint.canApplyTheme()) - || (mStrokeColorStateList != null && mStrokeColorStateList.canApplyTheme()) - || (mColorStateList != null && mColorStateList.canApplyTheme()) + || (mStrokeColors != null && mStrokeColors.canApplyTheme()) + || (mSolidColors != null && mSolidColors.canApplyTheme()) || super.canApplyTheme(); } @@ -1672,7 +1674,10 @@ public class GradientDrawable extends Drawable { @Override public int getChangingConfigurations() { - return mChangingConfigurations; + return mChangingConfigurations + | (mStrokeColors != null ? mStrokeColors.getChangingConfigurations() : 0) + | (mSolidColors != null ? mSolidColors.getChangingConfigurations() : 0) + | (mTint != null ? mTint.getChangingConfigurations() : 0); } public void setShape(int shape) { @@ -1689,15 +1694,15 @@ public class GradientDrawable extends Drawable { mCenterY = y; } - public void setColors(int[] colors) { - mColors = colors; - mColorStateList = null; + public void setGradientColors(int[] colors) { + mGradientColors = colors; + mSolidColors = null; computeOpacity(); } - public void setColorStateList(ColorStateList colorStateList) { - mColors = null; - mColorStateList = colorStateList; + public void setSolidColors(ColorStateList colors) { + mGradientColors = null; + mSolidColors = colors; computeOpacity(); } @@ -1705,16 +1710,16 @@ public class GradientDrawable extends Drawable { mOpaqueOverBounds = false; mOpaqueOverShape = false; - if (mColors != null) { - for (int i = 0; i < mColors.length; i++) { - if (!isOpaque(mColors[i])) { + if (mGradientColors != null) { + for (int i = 0; i < mGradientColors.length; i++) { + if (!isOpaque(mGradientColors[i])) { return; } } } // An unfilled shape is not opaque over bounds or shape - if (mColors == null && mColorStateList == null) { + if (mGradientColors == null && mSolidColors == null) { return; } @@ -1726,10 +1731,9 @@ public class GradientDrawable extends Drawable { && mRadiusArray == null; } - public void setStroke( - int width, ColorStateList colorStateList, float dashWidth, float dashGap) { + public void setStroke(int width, ColorStateList colors, float dashWidth, float dashGap) { mStrokeWidth = width; - mStrokeColorStateList = colorStateList; + mStrokeColors = colors; mStrokeDashWidth = dashWidth; mStrokeDashGap = dashGap; computeOpacity(); @@ -1781,11 +1785,11 @@ public class GradientDrawable extends Drawable { private void updateLocalState(Resources res) { final GradientState state = mGradientState; - if (state.mColorStateList != null) { + if (state.mSolidColors != null) { final int[] currentState = getState(); - final int stateColor = state.mColorStateList.getColorForState(currentState, 0); + final int stateColor = state.mSolidColors.getColorForState(currentState, 0); mFillPaint.setColor(stateColor); - } else if (state.mColors == null) { + } else if (state.mGradientColors == null) { // If we don't have a solid color and we don't have a gradient, // the app is stroking the shape, set the color to the default // value of state.mSolidColor @@ -1802,9 +1806,9 @@ public class GradientDrawable extends Drawable { mStrokePaint.setStyle(Paint.Style.STROKE); mStrokePaint.setStrokeWidth(state.mStrokeWidth); - if (state.mStrokeColorStateList != null) { + if (state.mStrokeColors != null) { final int[] currentState = getState(); - final int strokeStateColor = state.mStrokeColorStateList.getColorForState( + final int strokeStateColor = state.mStrokeColors.getColorForState( currentState, 0); mStrokePaint.setColor(strokeStateColor); } diff --git a/graphics/java/android/graphics/drawable/InsetDrawable.java b/graphics/java/android/graphics/drawable/InsetDrawable.java index 97f7105..e1ebdbb 100644 --- a/graphics/java/android/graphics/drawable/InsetDrawable.java +++ b/graphics/java/android/graphics/drawable/InsetDrawable.java @@ -242,26 +242,12 @@ public class InsetDrawable extends DrawableWrapper { } @Override - public ConstantState getConstantState() { - if (mState.canConstantState()) { - mState.mChangingConfigurations = getChangingConfigurations(); - return mState; - } - return null; - } - - @Override DrawableWrapperState mutateConstantState() { mState = new InsetState(mState); return mState; } static final class InsetState extends DrawableWrapper.DrawableWrapperState { - int[] mThemeAttrs; - int mChangingConfigurations; - - ConstantState mDrawableState; - int mInsetLeft = 0; int mInsetTop = 0; int mInsetRight = 0; diff --git a/graphics/java/android/graphics/drawable/LayerDrawable.java b/graphics/java/android/graphics/drawable/LayerDrawable.java index 30fbe16..a2f71e5 100644 --- a/graphics/java/android/graphics/drawable/LayerDrawable.java +++ b/graphics/java/android/graphics/drawable/LayerDrawable.java @@ -296,6 +296,9 @@ public class LayerDrawable extends Drawable implements Drawable.Callback { final Drawable d = layer.mDrawable; if (d.canApplyTheme()) { d.applyTheme(t); + + // Update cached mask of child changing configurations. + state.mChildrenChangingConfigurations |= d.getChangingConfigurations(); } } @@ -882,9 +885,7 @@ public class LayerDrawable extends Drawable implements Drawable.Callback { @Override public int getChangingConfigurations() { - return super.getChangingConfigurations() - | mLayerState.mChangingConfigurations - | mLayerState.mChildrenChangingConfigurations; + return super.getChangingConfigurations() | mLayerState.getChangingConfigurations(); } @Override @@ -1493,7 +1494,8 @@ public class LayerDrawable extends Drawable implements Drawable.Callback { @Override public int getChangingConfigurations() { - return mChangingConfigurations; + return mChangingConfigurations + | mChildrenChangingConfigurations; } public final int getOpacity() { diff --git a/graphics/java/android/graphics/drawable/NinePatchDrawable.java b/graphics/java/android/graphics/drawable/NinePatchDrawable.java index 487162e..9bf33cf 100644 --- a/graphics/java/android/graphics/drawable/NinePatchDrawable.java +++ b/graphics/java/android/graphics/drawable/NinePatchDrawable.java @@ -266,7 +266,7 @@ public class NinePatchDrawable extends Drawable { @Override public int getChangingConfigurations() { - return super.getChangingConfigurations() | mNinePatchState.mChangingConfigurations; + return super.getChangingConfigurations() | mNinePatchState.getChangingConfigurations(); } @Override @@ -498,7 +498,7 @@ public class NinePatchDrawable extends Drawable { } if (state.mTint != null && state.mTint.canApplyTheme()) { - state.mTint.applyTheme(t); + state.mTint = state.mTint.obtainForTheme(t); } updateLocalState(t.getResources()); @@ -680,7 +680,8 @@ public class NinePatchDrawable extends Drawable { @Override public int getChangingConfigurations() { - return mChangingConfigurations; + return mChangingConfigurations + | (mTint != null ? mTint.getChangingConfigurations() : 0); } } diff --git a/graphics/java/android/graphics/drawable/RippleDrawable.java b/graphics/java/android/graphics/drawable/RippleDrawable.java index 23f93fd..6731a17 100644 --- a/graphics/java/android/graphics/drawable/RippleDrawable.java +++ b/graphics/java/android/graphics/drawable/RippleDrawable.java @@ -479,7 +479,7 @@ public class RippleDrawable extends LayerDrawable { } if (state.mColor != null && state.mColor.canApplyTheme()) { - state.mColor.applyTheme(t); + state.mColor = state.mColor.obtainForTheme(t); } updateLocalState(); @@ -955,6 +955,12 @@ public class RippleDrawable extends LayerDrawable { public Drawable newDrawable(Resources res) { return new RippleDrawable(this, res); } + + @Override + public int getChangingConfigurations() { + return super.getChangingConfigurations() + | (mColor != null ? mColor.getChangingConfigurations() : 0); + } } private RippleDrawable(RippleState state, Resources res) { diff --git a/graphics/java/android/graphics/drawable/RotateDrawable.java b/graphics/java/android/graphics/drawable/RotateDrawable.java index 15e16f1..036a078 100644 --- a/graphics/java/android/graphics/drawable/RotateDrawable.java +++ b/graphics/java/android/graphics/drawable/RotateDrawable.java @@ -89,9 +89,6 @@ public class RotateDrawable extends DrawableWrapper { final RotateState state = mState; - // Account for any configuration changes. - state.mChangingConfigurations |= a.getChangingConfigurations(); - // Extract the theme attributes, if any. state.mThemeAttrs = a.extractThemeAttrs(); diff --git a/graphics/java/android/graphics/drawable/ShapeDrawable.java b/graphics/java/android/graphics/drawable/ShapeDrawable.java index fc88c15..532c51c 100644 --- a/graphics/java/android/graphics/drawable/ShapeDrawable.java +++ b/graphics/java/android/graphics/drawable/ShapeDrawable.java @@ -261,8 +261,7 @@ public class ShapeDrawable extends Drawable { @Override public int getChangingConfigurations() { - return super.getChangingConfigurations() - | mShapeState.mChangingConfigurations; + return super.getChangingConfigurations() | mShapeState.getChangingConfigurations(); } /** @@ -427,7 +426,7 @@ public class ShapeDrawable extends Drawable { // Apply theme to contained color state list. if (state.mTint != null && state.mTint.canApplyTheme()) { - state.mTint.applyTheme(t); + state.mTint = state.mTint.obtainForTheme(t); } // Update local properties. @@ -578,7 +577,8 @@ public class ShapeDrawable extends Drawable { @Override public int getChangingConfigurations() { - return mChangingConfigurations; + return mChangingConfigurations + | (mTint != null ? mTint.getChangingConfigurations() : 0); } } diff --git a/graphics/java/android/graphics/drawable/VectorDrawable.java b/graphics/java/android/graphics/drawable/VectorDrawable.java index b827682..a542feb 100644 --- a/graphics/java/android/graphics/drawable/VectorDrawable.java +++ b/graphics/java/android/graphics/drawable/VectorDrawable.java @@ -389,7 +389,7 @@ public class VectorDrawable extends Drawable { // Apply theme to contained color state list. if (state.mTint != null && state.mTint.canApplyTheme()) { - state.mTint.applyTheme(t); + state.mTint = state.mTint.obtainForTheme(t); } final VPathRenderer path = state.mVPathRenderer; @@ -625,7 +625,7 @@ public class VectorDrawable extends Drawable { @Override public int getChangingConfigurations() { - return super.getChangingConfigurations() | mVectorState.mChangingConfigurations; + return super.getChangingConfigurations() | mVectorState.getChangingConfigurations(); } void setAllowCaching(boolean allowCaching) { @@ -784,7 +784,8 @@ public class VectorDrawable extends Drawable { @Override public int getChangingConfigurations() { - return mChangingConfigurations; + return mChangingConfigurations + | (mTint != null ? mTint.getChangingConfigurations() : 0); } } |