Fix issues with theming of preloaded ColorStateLists
Ensures changing configurations mask is propagated to the host drawable so that it can be properly cleared from cache on configuration changes. Also fixes constant state handling of the mask in the Inset and Rotate drawables. Hides new ColorStateList methods related to theming, since they should only be used during preloading or internally by framework drawables. Fixes bug where the cached versions of themeable ColorStateLists were modified by calling applyTheme() on the host drawable. Also cleans up some docs and naming in GradientDrawable. Bug: 19966397 Change-Id: I8c8d3cabbaf94b488c2b8fe9fd423e07d824c19c
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user