Deprecate useless BitmapDrawable constructor

Bug #2590549

Change-Id: Icb45bf2d9836c43ed0825105f64d7b98afcdcdac
This commit is contained in:
Romain Guy
2013-02-08 13:58:53 -08:00
parent d71ff91dcd
commit 7ac40e3869
3 changed files with 7 additions and 3 deletions

View File

@@ -9376,7 +9376,7 @@ package android.graphics.drawable {
public class BitmapDrawable extends android.graphics.drawable.Drawable {
ctor public deprecated BitmapDrawable();
ctor public BitmapDrawable(android.content.res.Resources);
ctor public deprecated BitmapDrawable(android.content.res.Resources);
ctor public deprecated BitmapDrawable(android.graphics.Bitmap);
ctor public BitmapDrawable(android.content.res.Resources, android.graphics.Bitmap);
ctor public deprecated BitmapDrawable(java.lang.String);

View File

@@ -74,8 +74,8 @@ public class BitmapDrawable extends Drawable {
/**
* Create an empty drawable, not dealing with density.
* @deprecated Use {@link #BitmapDrawable(Resources)} to ensure
* that the drawable has correctly set its target density.
* @deprecated Use {@link #BitmapDrawable(android.content.res.Resources, android.graphics.Bitmap)}
* instead to specify a bitmap to draw with and ensure the correct density is set.
*/
@Deprecated
public BitmapDrawable() {
@@ -85,7 +85,10 @@ public class BitmapDrawable extends Drawable {
/**
* Create an empty drawable, setting initial target density based on
* the display metrics of the resources.
* @deprecated Use {@link #BitmapDrawable(android.content.res.Resources, android.graphics.Bitmap)}
* instead to specify a bitmap to draw with.
*/
@Deprecated
@SuppressWarnings({"UnusedParameters"})
public BitmapDrawable(Resources res) {
mBitmapState = new BitmapState((Bitmap) null);

View File

@@ -868,6 +868,7 @@ public abstract class Drawable {
} else if (name.equals("inset")) {
drawable = new InsetDrawable();
} else if (name.equals("bitmap")) {
//noinspection deprecation
drawable = new BitmapDrawable(r);
if (r != null) {
((BitmapDrawable) drawable).setTargetDensity(r.getDisplayMetrics());