summaryrefslogtreecommitdiff
path: root/src/com/android/bitmap/view/BitmapDrawableImageView.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/bitmap/view/BitmapDrawableImageView.java')
-rw-r--r--src/com/android/bitmap/view/BitmapDrawableImageView.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/com/android/bitmap/view/BitmapDrawableImageView.java b/src/com/android/bitmap/view/BitmapDrawableImageView.java
index 5d42b6c..e9df6d3 100644
--- a/src/com/android/bitmap/view/BitmapDrawableImageView.java
+++ b/src/com/android/bitmap/view/BitmapDrawableImageView.java
@@ -34,6 +34,9 @@ import com.android.bitmap.drawable.BasicBitmapDrawable;
public class BitmapDrawableImageView extends ImageView {
private static final boolean HAS_TRANSIENT_STATE_SUPPORTED =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
+ private static final boolean TEMPORARY = true;
+ private static final boolean PERMANENT = !TEMPORARY;
+
private BasicBitmapDrawable mDrawable;
private boolean mAttachedToWindow;
@@ -74,8 +77,12 @@ public class BitmapDrawableImageView extends ImageView {
}
private void unbindDrawable() {
+ unbindDrawable(PERMANENT);
+ }
+
+ private void unbindDrawable(boolean temporary) {
if (mDrawable != null) {
- mDrawable.unbind();
+ mDrawable.unbind(temporary);
}
}
@@ -121,7 +128,7 @@ public class BitmapDrawableImageView extends ImageView {
super.onDetachedFromWindow();
mAttachedToWindow = false;
if (HAS_TRANSIENT_STATE_SUPPORTED && !hasTransientState()) {
- unbindDrawable();
+ unbindDrawable(TEMPORARY);
}
}
@@ -129,7 +136,7 @@ public class BitmapDrawableImageView extends ImageView {
public void setHasTransientState(boolean hasTransientState) {
super.setHasTransientState(hasTransientState);
if (!hasTransientState && !mAttachedToWindow) {
- unbindDrawable();
+ unbindDrawable(TEMPORARY);
}
}
}