File tree Expand file tree Collapse file tree 1 file changed +4
-13
lines changed
src/net/tsz/afinal/bitmap/core Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change 16
16
package net .tsz .afinal .bitmap .core ;
17
17
18
18
import java .lang .ref .SoftReference ;
19
-
20
- import net .tsz .afinal .utils .Utils ;
19
+ import java .util .HashMap ;
21
20
22
21
import android .graphics .Bitmap ;
23
22
24
23
public class SoftMemoryCacheImpl implements IMemoryCache {
25
24
26
- private final LruMemoryCache <String , SoftReference <Bitmap >> mMemoryCache ;
25
+ private final HashMap <String , SoftReference <Bitmap >> mMemoryCache ;
27
26
28
27
public SoftMemoryCacheImpl (int size ) {
29
- mMemoryCache = new LruMemoryCache <String , SoftReference <Bitmap >>(size ) {
30
- @ Override
31
- protected int sizeOf (String key , SoftReference <Bitmap > sBitmap ) {
32
- final Bitmap bitmap = sBitmap ==null ? null : sBitmap .get ();
33
- if (bitmap == null )
34
- return 1 ;
35
- return Utils .getBitmapSize (bitmap );
36
- }
37
- };
28
+ mMemoryCache = new HashMap <String , SoftReference <Bitmap >>(size );
38
29
}
39
30
40
31
@ Override
@@ -53,7 +44,7 @@ public Bitmap get(String key) {
53
44
54
45
@ Override
55
46
public void evictAll () {
56
- mMemoryCache .evictAll ();
47
+ mMemoryCache .clear ();
57
48
}
58
49
59
50
@ Override
You can’t perform that action at this time.
0 commit comments