aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-02-18 06:40:32 -0800
committerScott Jackson <daneren2005@gmail.com>2014-02-18 06:40:32 -0800
commit0190b396904012841f3d938d8db9d115321cc716 (patch)
tree41ddd5bd5013f462c06a92548059d9641a16de33
parent4e8d6cbc92a5460ca1d5099573363f113ff7cf3b (diff)
downloaddsub-0190b396904012841f3d938d8db9d115321cc716.tar.gz
dsub-0190b396904012841f3d938d8db9d115321cc716.tar.bz2
dsub-0190b396904012841f3d938d8db9d115321cc716.zip
#276 Clear the bitmap cache when exiting the application
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java2
-rw-r--r--src/github/daneren2005/dsub/util/ImageLoader.java5
2 files changed, 7 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
index 9c8bcaa3..982c7f80 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
@@ -55,6 +55,7 @@ import github.daneren2005.dsub.fragments.SubsonicFragment;
import github.daneren2005.dsub.service.DownloadFile;
import github.daneren2005.dsub.service.DownloadService;
import github.daneren2005.dsub.updates.Updater;
+import github.daneren2005.dsub.util.BackgroundTask;
import github.daneren2005.dsub.util.Constants;
import github.daneren2005.dsub.util.FileUtil;
import github.daneren2005.dsub.util.SilentBackgroundTask;
@@ -81,6 +82,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
if (getIntent().hasExtra(Constants.INTENT_EXTRA_NAME_EXIT)) {
stopService(new Intent(this, DownloadService.class));
finish();
+ getImageLoader().clearCache();
} else if(getIntent().hasExtra(Constants.INTENT_EXTRA_NAME_DOWNLOAD)) {
DownloadService service = getDownloadService();
boolean downloadView = getIntent().hasExtra(Constants.INTENT_EXTRA_NAME_DOWNLOAD_VIEW);
diff --git a/src/github/daneren2005/dsub/util/ImageLoader.java b/src/github/daneren2005/dsub/util/ImageLoader.java
index 10b6434e..88ea37ee 100644
--- a/src/github/daneren2005/dsub/util/ImageLoader.java
+++ b/src/github/daneren2005/dsub/util/ImageLoader.java
@@ -88,6 +88,11 @@ public class ImageLoader {
createLargeUnknownImage(context);
}
+ public void clearCache() {
+ nowPlaying = null;
+ cache.evictAll();
+ }
+
private void createLargeUnknownImage(Context context) {
BitmapDrawable drawable = (BitmapDrawable) context.getResources().getDrawable(R.drawable.unknown_album_large);
Bitmap bitmap = Bitmap.createScaledBitmap(drawable.getBitmap(), imageSizeLarge, imageSizeLarge, true);