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:
Alan Viverette
2014-10-14 14:07:21 -07:00
parent 2f82e48abb
commit 17cd4dfe3a
22 changed files with 333 additions and 402 deletions

View File

@@ -592,8 +592,6 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
final DrawableContainer mOwner;
final Resources mRes;
Theme mTheme;
SparseArray<ConstantStateFuture> mDrawableFutures;
int mChangingConfigurations;
@@ -801,17 +799,17 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
}
final void applyTheme(Theme theme) {
// No need to call createAllFutures, since future drawables will
// apply the theme when they are prepared.
final int N = mNumChildren;
final Drawable[] drawables = mDrawables;
for (int i = 0; i < N; i++) {
if (drawables[i] != null) {
drawables[i].applyTheme(theme);
if (theme != null) {
createAllFutures();
final int N = mNumChildren;
final Drawable[] drawables = mDrawables;
for (int i = 0; i < N; i++) {
if (drawables[i] != null && drawables[i].canApplyTheme()) {
drawables[i].applyTheme(theme);
}
}
}
mTheme = theme;
}
@Override
@@ -1068,10 +1066,8 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
final Drawable result;
if (state.mRes == null) {
result = mConstantState.newDrawable();
} else if (state.mTheme == null) {
result = mConstantState.newDrawable(state.mRes);
} else {
result = mConstantState.newDrawable(state.mRes, state.mTheme);
result = mConstantState.newDrawable(state.mRes);
}
result.setLayoutDirection(state.mLayoutDirection);
result.setCallback(state.mOwner);