summaryrefslogtreecommitdiff
path: root/src/com/android/bitmap/drawable/ExtendedBitmapDrawable.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/bitmap/drawable/ExtendedBitmapDrawable.java')
-rw-r--r--src/com/android/bitmap/drawable/ExtendedBitmapDrawable.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/com/android/bitmap/drawable/ExtendedBitmapDrawable.java b/src/com/android/bitmap/drawable/ExtendedBitmapDrawable.java
index b6093e7..0e01142 100644
--- a/src/com/android/bitmap/drawable/ExtendedBitmapDrawable.java
+++ b/src/com/android/bitmap/drawable/ExtendedBitmapDrawable.java
@@ -71,9 +71,12 @@ public class ExtendedBitmapDrawable extends BasicBitmapDrawable implements
private final Handler mHandler = new Handler();
public ExtendedBitmapDrawable(final Resources res, final BitmapCache cache,
- final boolean limitDensity, final ExtendedOptions opts) {
+ final boolean limitDensity, ExtendedOptions opts) {
super(res, cache, limitDensity);
mResources = res;
+ if (opts == null) {
+ opts = new ExtendedOptions(0);
+ }
mOpts = opts;
onOptsChanged();
@@ -258,8 +261,8 @@ public class ExtendedBitmapDrawable extends BasicBitmapDrawable implements
// Draw the two possible overlay layers in reverse-priority order.
// (each layer will no-op the draw when appropriate)
// This ordering means cross-fade transitions are just fade-outs of each layer.
- if (mProgress != null) mProgress.draw(canvas);
- if (mPlaceholder != null) mPlaceholder.draw(canvas);
+ if (mProgress != null) onDrawPlaceholderOrProgress(canvas, mProgress);
+ if (mPlaceholder != null) onDrawPlaceholderOrProgress(canvas, mPlaceholder);
}
/**
@@ -269,6 +272,13 @@ public class ExtendedBitmapDrawable extends BasicBitmapDrawable implements
super.draw(canvas);
}
+ /**
+ * Overriding this method to add your own custom placeholder or progress drawing.
+ */
+ protected void onDrawPlaceholderOrProgress(final Canvas canvas, final TileDrawable drawable) {
+ drawable.draw(canvas);
+ }
+
@Override
public void setAlpha(int alpha) {
final int old = mPaint.getAlpha();