Save only one image in the cover cache
This commit is contained in:
parent
9dba85e38d
commit
6214026be8
|
@ -38,7 +38,6 @@ public class FeedImageLoader {
|
||||||
.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass();
|
.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass();
|
||||||
|
|
||||||
// Use 1/8th of the available memory for this memory cache.
|
// Use 1/8th of the available memory for this memory cache.
|
||||||
final int coverCacheSize = 1024 * 1024 * memClass / 8;
|
|
||||||
final int thumbnailCacheSize = 1024 * 1024 * memClass / 8;
|
final int thumbnailCacheSize = 1024 * 1024 * memClass / 8;
|
||||||
|
|
||||||
private LruCache<String, CachedBitmap> coverCache;
|
private LruCache<String, CachedBitmap> coverCache;
|
||||||
|
@ -48,20 +47,7 @@ public class FeedImageLoader {
|
||||||
handler = new Handler();
|
handler = new Handler();
|
||||||
executor = createExecutor();
|
executor = createExecutor();
|
||||||
|
|
||||||
coverCache = new LruCache<String, CachedBitmap>(coverCacheSize) {
|
coverCache = new LruCache<String, CachedBitmap>(1);
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
|
||||||
@Override
|
|
||||||
protected int sizeOf(String key, CachedBitmap value) {
|
|
||||||
if (Integer.valueOf(android.os.Build.VERSION.SDK_INT) >= 12)
|
|
||||||
return value.getBitmap().getByteCount();
|
|
||||||
else
|
|
||||||
return (value.getBitmap().getRowBytes() * value.getBitmap()
|
|
||||||
.getHeight());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
thumbnailCache = new LruCache<String, CachedBitmap>(thumbnailCacheSize) {
|
thumbnailCache = new LruCache<String, CachedBitmap>(thumbnailCacheSize) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue