diff options
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/util/ImageLoader.java | 8 | ||||
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/util/Notifications.java | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/util/ImageLoader.java b/app/src/main/java/github/daneren2005/dsub/util/ImageLoader.java index 4ba72960..5da66023 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/ImageLoader.java +++ b/app/src/main/java/github/daneren2005/dsub/util/ImageLoader.java @@ -64,6 +64,7 @@ public class ImageLoader { private LruCache<String, Bitmap> cache; private Handler handler; private Bitmap nowPlaying; + private Bitmap nowPlayingSmall; private final int imageSizeDefault; private final int imageSizeLarge; private final int avatarSizeDefault; @@ -93,7 +94,7 @@ public class ImageLoader { @Override protected void entryRemoved(boolean evicted, String key, Bitmap oldBitmap, Bitmap newBitmap) { if(evicted) { - if(oldBitmap != nowPlaying || clearingCache) { + if((oldBitmap != nowPlaying && oldBitmap != nowPlayingSmall) || clearingCache) { oldBitmap.recycle(); } else { cache.put(key, oldBitmap); @@ -105,6 +106,7 @@ public class ImageLoader { public void clearCache() { nowPlaying = null; + nowPlayingSmall = null; new SilentBackgroundTask<Void>(context) { @Override protected Void doInBackground() throws Throwable { @@ -126,6 +128,10 @@ public class ImageLoader { } } + public void setNowPlayingSmall(Bitmap bitmap) { + nowPlayingSmall = bitmap; + } + private Bitmap getUnknownImage(MusicDirectory.Entry entry, int size) { String key; int color; diff --git a/app/src/main/java/github/daneren2005/dsub/util/Notifications.java b/app/src/main/java/github/daneren2005/dsub/util/Notifications.java index 499e2189..375c9966 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/Notifications.java +++ b/app/src/main/java/github/daneren2005/dsub/util/Notifications.java @@ -135,6 +135,7 @@ public final class Notifications { // set default album art rv.setImageViewResource(R.id.notification_image, R.drawable.unknown_album); } else { + imageLoader.setNowPlayingSmall(bitmap); rv.setImageViewBitmap(R.id.notification_image, bitmap); } } catch (Exception x) { |