summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wei <markwei@google.com>2013-12-02 14:11:25 -0800
committerMark Wei <markwei@google.com>2013-12-02 14:11:25 -0800
commit19a41ec7aaace2ab0b117d0baaeb544c5667b240 (patch)
tree856c084a54e290eb1d0370ef768e0ea0ccad0b77
parentdf3da61c8f2f54604376d9761649bdba54aa858b (diff)
downloadbitmap-19a41ec7aaace2ab0b117d0baaeb544c5667b240.tar.gz
Fix state changes bug that caused bitmaps in the cache to be faded in instead of
instantly shown. Change-Id: Ic2ba2d2ebe01badc881d1c43071a42bcf6f2b687
-rw-r--r--src/com/android/bitmap/drawable/BasicBitmapDrawable.java2
-rw-r--r--src/com/android/bitmap/drawable/ExtendedBitmapDrawable.java13
2 files changed, 6 insertions, 9 deletions
diff --git a/src/com/android/bitmap/drawable/BasicBitmapDrawable.java b/src/com/android/bitmap/drawable/BasicBitmapDrawable.java
index d0952f6..8fe1ff4 100644
--- a/src/com/android/bitmap/drawable/BasicBitmapDrawable.java
+++ b/src/com/android/bitmap/drawable/BasicBitmapDrawable.java
@@ -122,7 +122,7 @@ public class BasicBitmapDrawable extends Drawable implements DecodeCallback,
public final void setDecodeDimensions(int w, int h) {
mDecodeWidth = w;
mDecodeHeight = h;
- loadFileDescriptorFactory();
+ bind(mCurrKey);
}
/**
diff --git a/src/com/android/bitmap/drawable/ExtendedBitmapDrawable.java b/src/com/android/bitmap/drawable/ExtendedBitmapDrawable.java
index 2e3d43f..7be8b6e 100644
--- a/src/com/android/bitmap/drawable/ExtendedBitmapDrawable.java
+++ b/src/com/android/bitmap/drawable/ExtendedBitmapDrawable.java
@@ -142,9 +142,6 @@ public class ExtendedBitmapDrawable extends BasicBitmapDrawable implements
// this allows the initial transition to be specially instantaneous, so e.g. a cache hit
// doesn't unnecessarily trigger a fade-in
setLoadState(LOAD_STATE_UNINITIALIZED);
- if (key == null) {
- setLoadState(LOAD_STATE_FAILED);
- }
super.setImage(key);
}
@@ -159,12 +156,12 @@ public class ExtendedBitmapDrawable extends BasicBitmapDrawable implements
@Override
protected void loadFileDescriptorFactory() {
boolean executeStateChange = shouldExecuteStateChange();
+ if (mCurrKey == null || mDecodeWidth == 0 || mDecodeHeight == 0) {
+ return;
+ }
+
if (executeStateChange) {
- if (mCurrKey == null || mDecodeWidth == 0 || mDecodeHeight == 0) {
- setLoadState(LOAD_STATE_FAILED);
- } else {
- setLoadState(LOAD_STATE_NOT_YET_LOADED);
- }
+ setLoadState(LOAD_STATE_NOT_YET_LOADED);
}
super.loadFileDescriptorFactory();