use long type for cache sizes

This commit is contained in:
dkanada 2021-05-21 08:34:55 +09:00
commit d8a0ba23b6
4 changed files with 5 additions and 5 deletions

View file

@ -24,7 +24,7 @@ public class CustomGlideModule extends AppGlideModule {
@Override @Override
public void applyOptions(@NonNull Context context, GlideBuilder builder) { public void applyOptions(@NonNull Context context, GlideBuilder builder) {
File cacheDir = new File(PreferenceUtil.getInstance(context).getLocationCache(), "glide"); File cacheDir = new File(PreferenceUtil.getInstance(context).getLocationCache(), "glide");
int size = PreferenceUtil.getInstance(context).getImageCacheSize(); long size = PreferenceUtil.getInstance(context).getImageCacheSize();
builder.setDiskCache(new DiskLruCacheFactory(() -> cacheDir, size)); builder.setDiskCache(new DiskLruCacheFactory(() -> cacheDir, size));
builder.setDefaultRequestOptions(new RequestOptions().format(DecodeFormat.PREFER_RGB_565)); builder.setDefaultRequestOptions(new RequestOptions().format(DecodeFormat.PREFER_RGB_565));

View file

@ -381,11 +381,11 @@ public final class PreferenceUtil {
return mPreferences.getString(LOCATION_CACHE, mContext.getCacheDir().toString()); return mPreferences.getString(LOCATION_CACHE, mContext.getCacheDir().toString());
} }
public final int getImageCacheSize() { public final long getImageCacheSize() {
return Integer.parseInt(mPreferences.getString(IMAGE_CACHE_SIZE, "400000000")); return Integer.parseInt(mPreferences.getString(IMAGE_CACHE_SIZE, "400000000"));
} }
public final int getMediaCacheSize() { public final long getMediaCacheSize() {
return Integer.parseInt(mPreferences.getString(MEDIA_CACHE_SIZE, "400000000")); return Integer.parseInt(mPreferences.getString(MEDIA_CACHE_SIZE, "400000000"));
} }

View file

@ -61,7 +61,7 @@
</string-array> </string-array>
<string-array name="pref_cache_size_values"> <string-array name="pref_cache_size_values">
<item>2147483647</item> <item>10000000000</item>
<item>2000000000</item> <item>2000000000</item>
<item>1000000000</item> <item>1000000000</item>
<item>400000000</item> <item>400000000</item>

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<paths> <paths>
<external-path name="external_files" path="."/> <external-path name="external_files" path="." />
</paths> </paths>