Update preload list, clean up drawable theming
Removes all implementations of three-arg ConstantState constructor, since we handle mutation and applyTheme() in Resources now. Moves progress bar tinting to android:tint attribute. Correctly implements applyTheme() and canApplyTheme() in all drawable wrapper and container classes. Change-Id: Ic9cb43d0d6228aa4914f3124bed234b837beaa41
This commit is contained in:
@@ -170,24 +170,30 @@ public class InsetDrawable extends Drawable implements Drawable.Callback {
|
||||
super.applyTheme(t);
|
||||
|
||||
final InsetState state = mInsetState;
|
||||
if (state == null || state.mThemeAttrs == null) {
|
||||
if (state == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final TypedArray a = t.resolveAttributes(state.mThemeAttrs, R.styleable.InsetDrawable);
|
||||
try {
|
||||
updateStateFromTypedArray(a);
|
||||
verifyRequiredAttributes(a);
|
||||
} catch (XmlPullParserException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
a.recycle();
|
||||
if (state.mThemeAttrs != null) {
|
||||
final TypedArray a = t.resolveAttributes(state.mThemeAttrs, R.styleable.InsetDrawable);
|
||||
try {
|
||||
updateStateFromTypedArray(a);
|
||||
verifyRequiredAttributes(a);
|
||||
} catch (XmlPullParserException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
a.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
if (state.mDrawable != null && state.mDrawable.canApplyTheme()) {
|
||||
state.mDrawable.applyTheme(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canApplyTheme() {
|
||||
return mInsetState != null && mInsetState.mThemeAttrs != null;
|
||||
return super.canApplyTheme() || mInsetState != null && mInsetState.canApplyTheme();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -438,6 +444,12 @@ public class InsetDrawable extends Drawable implements Drawable.Callback {
|
||||
return mChangingConfigurations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canApplyTheme() {
|
||||
return super.canApplyTheme() || mThemeAttrs != null
|
||||
|| mDrawable != null && mDrawable.canApplyTheme();
|
||||
}
|
||||
|
||||
boolean canConstantState() {
|
||||
if (!mCheckedConstantState) {
|
||||
mCanConstantState = mDrawable.getConstantState() != null;
|
||||
|
||||
Reference in New Issue
Block a user