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:
@@ -132,7 +132,7 @@ public class BitmapDrawable extends Drawable {
|
||||
*/
|
||||
@Deprecated
|
||||
public BitmapDrawable(Bitmap bitmap) {
|
||||
this(new BitmapState(bitmap), null, null);
|
||||
this(new BitmapState(bitmap), null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,7 +140,7 @@ public class BitmapDrawable extends Drawable {
|
||||
* the display metrics of the resources.
|
||||
*/
|
||||
public BitmapDrawable(Resources res, Bitmap bitmap) {
|
||||
this(new BitmapState(bitmap), res, null);
|
||||
this(new BitmapState(bitmap), res);
|
||||
mBitmapState.mTargetDensity = mTargetDensity;
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ public class BitmapDrawable extends Drawable {
|
||||
*/
|
||||
@Deprecated
|
||||
public BitmapDrawable(String filepath) {
|
||||
this(new BitmapState(BitmapFactory.decodeFile(filepath)), null, null);
|
||||
this(new BitmapState(BitmapFactory.decodeFile(filepath)), null);
|
||||
if (mBitmapState.mBitmap == null) {
|
||||
android.util.Log.w("BitmapDrawable", "BitmapDrawable cannot decode " + filepath);
|
||||
}
|
||||
@@ -162,7 +162,7 @@ public class BitmapDrawable extends Drawable {
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public BitmapDrawable(Resources res, String filepath) {
|
||||
this(new BitmapState(BitmapFactory.decodeFile(filepath)), null, null);
|
||||
this(new BitmapState(BitmapFactory.decodeFile(filepath)), null);
|
||||
mBitmapState.mTargetDensity = mTargetDensity;
|
||||
if (mBitmapState.mBitmap == null) {
|
||||
android.util.Log.w("BitmapDrawable", "BitmapDrawable cannot decode " + filepath);
|
||||
@@ -176,7 +176,7 @@ public class BitmapDrawable extends Drawable {
|
||||
*/
|
||||
@Deprecated
|
||||
public BitmapDrawable(java.io.InputStream is) {
|
||||
this(new BitmapState(BitmapFactory.decodeStream(is)), null, null);
|
||||
this(new BitmapState(BitmapFactory.decodeStream(is)), null);
|
||||
if (mBitmapState.mBitmap == null) {
|
||||
android.util.Log.w("BitmapDrawable", "BitmapDrawable cannot decode " + is);
|
||||
}
|
||||
@@ -187,7 +187,7 @@ public class BitmapDrawable extends Drawable {
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public BitmapDrawable(Resources res, java.io.InputStream is) {
|
||||
this(new BitmapState(BitmapFactory.decodeStream(is)), null, null);
|
||||
this(new BitmapState(BitmapFactory.decodeStream(is)), null);
|
||||
mBitmapState.mTargetDensity = mTargetDensity;
|
||||
if (mBitmapState.mBitmap == null) {
|
||||
android.util.Log.w("BitmapDrawable", "BitmapDrawable cannot decode " + is);
|
||||
@@ -919,17 +919,12 @@ public class BitmapDrawable extends Drawable {
|
||||
|
||||
@Override
|
||||
public Drawable newDrawable() {
|
||||
return new BitmapDrawable(this, null, null);
|
||||
return new BitmapDrawable(this, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Drawable newDrawable(Resources res) {
|
||||
return new BitmapDrawable(this, res, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Drawable newDrawable(Resources res, Theme theme) {
|
||||
return new BitmapDrawable(this, res, theme);
|
||||
return new BitmapDrawable(this, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -942,16 +937,10 @@ public class BitmapDrawable extends Drawable {
|
||||
* The one constructor to rule them all. This is called by all public
|
||||
* constructors to set the state and initialize local properties.
|
||||
*/
|
||||
private BitmapDrawable(BitmapState state, Resources res, Theme theme) {
|
||||
if (theme != null && state.canApplyTheme()) {
|
||||
// If we need to apply a theme, implicitly mutate.
|
||||
mBitmapState = new BitmapState(state);
|
||||
applyTheme(theme);
|
||||
} else {
|
||||
mBitmapState = state;
|
||||
}
|
||||
private BitmapDrawable(BitmapState state, Resources res) {
|
||||
mBitmapState = state;
|
||||
|
||||
initializeWithState(state, res);
|
||||
initializeWithState(mBitmapState, res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user