44
44
*/
45
45
public class DefaultConfigurationFactory {
46
46
47
- /** Create {@linkplain HashCodeFileNameGenerator default implementation} of FileNameGenerator */
47
+ /** Creates {@linkplain HashCodeFileNameGenerator default implementation} of FileNameGenerator */
48
48
public static FileNameGenerator createFileNameGenerator () {
49
49
return new HashCodeFileNameGenerator ();
50
50
}
51
51
52
- /** Create default implementation of {@link DisckCacheAware} depends on incoming parameters */
52
+ /** Creates default implementation of {@link DisckCacheAware} depends on incoming parameters */
53
53
public static DiscCacheAware createDiscCache (Context context , FileNameGenerator discCacheFileNameGenerator , int discCacheSize , int discCacheFileCount ) {
54
54
if (discCacheSize > 0 ) {
55
55
File individualCacheDir = StorageUtils .getIndividualCacheDirectory (context );
@@ -63,7 +63,17 @@ public static DiscCacheAware createDiscCache(Context context, FileNameGenerator
63
63
}
64
64
}
65
65
66
- /** Create default implementation of {@link MemoryCacheAware} depends on incoming parameters */
66
+ /** Creates reserve disc cache which will be used if primary disc cache becomes unavailable */
67
+ public static DiscCacheAware createReserveDiscCache (Context context ) {
68
+ File cacheDir = context .getCacheDir ();
69
+ File individualDir = new File (cacheDir , "uil-images" );
70
+ if (individualDir .exists () || individualDir .mkdir ()) {
71
+ cacheDir = individualDir ;
72
+ }
73
+ return new TotalSizeLimitedDiscCache (cacheDir , 2 * 1024 * 1024 ); // limit - 2 Mb
74
+ }
75
+
76
+ /** Creates default implementation of {@link MemoryCacheAware} depends on incoming parameters */
67
77
public static MemoryCacheAware <String , Bitmap > createMemoryCache (int memoryCacheSize , boolean denyCacheImageMultipleSizesInMemory ) {
68
78
MemoryCacheAware <String , Bitmap > memoryCache = new UsingFreqLimitedMemoryCache (memoryCacheSize );
69
79
if (denyCacheImageMultipleSizesInMemory ) {
@@ -72,12 +82,12 @@ public static MemoryCacheAware<String, Bitmap> createMemoryCache(int memoryCache
72
82
return memoryCache ;
73
83
}
74
84
75
- /** Create default implementation of {@link ImageDownloader} - {@link BaseImageDownloader} */
85
+ /** Creates default implementation of {@link ImageDownloader} - {@link BaseImageDownloader} */
76
86
public static ImageDownloader createImageDownloader (Context context ) {
77
87
return new BaseImageDownloader (context );
78
88
}
79
89
80
- /** Create default implementation of {@link BitmapDisplayer} */
90
+ /** Creates default implementation of {@link BitmapDisplayer} */
81
91
public static BitmapDisplayer createBitmapDisplayer () {
82
92
return new SimpleBitmapDisplayer ();
83
93
}
0 commit comments