Evict cached bitmaps when closing the app list

This commit is contained in:
Cameron Gutman 2015-02-27 15:13:43 -05:00
parent 3d398ef6dd
commit 867b703644
3 changed files with 10 additions and 0 deletions

View File

@ -75,6 +75,8 @@ public class AppGridAdapter extends GenericGridAdapter<AppView.AppObject> {
public void cancelQueuedOperations() {
cancelTuples(loadingTuples);
cancelTuples(backgroundLoadingTuples);
loader.freeCacheMemory();
}
private void sortList() {

View File

@ -30,6 +30,10 @@ public class CachedAppAssetLoader {
this.diskLoader = diskLoader;
}
public void freeCacheMemory() {
memoryLoader.clearCache();
}
private Runnable createLoaderRunnable(final LoaderTuple tuple, final Object context, final LoadListener listener) {
return new Runnable() {
@Override

View File

@ -30,4 +30,8 @@ public class MemoryAssetLoader {
public void populateCache(CachedAppAssetLoader.LoaderTuple tuple, Bitmap bitmap) {
memoryCache.put(constructKey(tuple), bitmap);
}
public void clearCache() {
memoryCache.evictAll();
}
}