aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android/src/github/daneren2005
diff options
context:
space:
mode:
authorFenny Fatal <Fenny@Fennyfatal.com>2013-07-22 01:47:34 -0600
committerFenny Fatal <Fenny@Fennyfatal.com>2013-07-22 01:47:34 -0600
commitadbfbc61b33e9e1b505f7a05b844af1c1d078b20 (patch)
tree1b4c90bd2932211b1de2104b67f9a0029095097d /subsonic-android/src/github/daneren2005
parent9235964fe5267ccbfbf2149b902e7c619fec491b (diff)
downloaddsub-adbfbc61b33e9e1b505f7a05b844af1c1d078b20.tar.gz
dsub-adbfbc61b33e9e1b505f7a05b844af1c1d078b20.tar.bz2
dsub-adbfbc61b33e9e1b505f7a05b844af1c1d078b20.zip
Okay, now we load all images if they have been recycled. We also check for a recycled current image if we are trying to transition. No more CRASHES on 4.3
Diffstat (limited to 'subsonic-android/src/github/daneren2005')
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/util/ImageLoader.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/util/ImageLoader.java b/subsonic-android/src/github/daneren2005/dsub/util/ImageLoader.java
index 782d74d6..1fb5f083 100644
--- a/subsonic-android/src/github/daneren2005/dsub/util/ImageLoader.java
+++ b/subsonic-android/src/github/daneren2005/dsub/util/ImageLoader.java
@@ -108,7 +108,7 @@ public class ImageLoader implements Runnable {
int size = large ? imageSizeLarge : imageSizeDefault;
Bitmap bitmap = cache.get(getKey(entry.getCoverArt(), size));
- if (bitmap != null) {
+ if (bitmap != null && !bitmap.isRecycled()) {
final Drawable drawable = Util.createDrawableFromBitmap(this.context, bitmap);
setImage(view, drawable, large);
if(large) {
@@ -130,7 +130,7 @@ public class ImageLoader implements Runnable {
}
Bitmap bitmap = cache.get(getKey(entry.getCoverArt(), imageSizeLarge));
- if (bitmap != null) {
+ if (bitmap != null && !bitmap.isRecycled()) {
Drawable drawable = Util.createDrawableFromBitmap(this.context, bitmap);
setImage(remoteControl, drawable);
return;
@@ -172,15 +172,18 @@ public class ImageLoader implements Runnable {
// Do nothing, just means that the drawable is a flat image
}
}
-
+ if (!(((BitmapDrawable)existingDrawable).getBitmap().isRecycled()))
+ { // We will flow through to the non-transition if the old image is recycled... Yay 4.3
Drawable[] layers = new Drawable[]{existingDrawable, drawable};
TransitionDrawable transitionDrawable = new TransitionDrawable(layers);
imageView.setImageDrawable(transitionDrawable);
transitionDrawable.startTransition(250);
- } else {
- imageView.setImageDrawable(drawable);
+ return;
+ }
}
+ imageView.setImageDrawable(drawable);
+ return;
}
}
@@ -194,7 +197,8 @@ public class ImageLoader implements Runnable {
origBitmap)
.apply();
} else {
- remoteControl.editMetadata(true)
+ Log.e(TAG, "Tried to load a recycled bitmap.");
+ remoteControl.editMetadata(false)
.putBitmap(RemoteControlClient.MetadataEditor.BITMAP_KEY_ARTWORK, null)
.apply();
}