remove external cache option
This commit is contained in:
parent
ce4558eff1
commit
ffa0dffa26
3 changed files with 2 additions and 17 deletions
|
|
@ -2,7 +2,6 @@ package com.dkanada.gramophone.glide;
|
|||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Environment;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
|
|
@ -23,11 +22,9 @@ import java.io.File;
|
|||
public class CustomGlideModule implements GlideModule {
|
||||
@Override
|
||||
public void applyOptions(@NonNull Context context, GlideBuilder builder) {
|
||||
File file = PreferenceUtil.getInstance(context).getExternalDirectory()
|
||||
? new File(Environment.getExternalStorageDirectory() + "/Gelli/images")
|
||||
: new File(App.getInstance().getApplicationInfo().dataDir + "/glide");
|
||||
|
||||
File file = new File(App.getInstance().getApplicationInfo().dataDir + "/glide");
|
||||
int size = PreferenceUtil.getInstance(context).getCacheSize();
|
||||
|
||||
builder.setDiskCache(new DiskLruCacheFactory(() -> file, size));
|
||||
builder.setDefaultRequestOptions(new RequestOptions().format(DecodeFormat.PREFER_RGB_565));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,6 @@ public final class PreferenceUtil {
|
|||
public static final String REMEMBER_QUEUE = "remember_queue";
|
||||
|
||||
public static final String CACHE_SIZE = "cache_size";
|
||||
public static final String EXTERNAL_DIRECTORY = "external_directory";
|
||||
|
||||
private static PreferenceUtil sInstance;
|
||||
|
||||
|
|
@ -392,10 +391,6 @@ public final class PreferenceUtil {
|
|||
return Integer.parseInt(mPreferences.getString(CACHE_SIZE, "400000000"));
|
||||
}
|
||||
|
||||
public final boolean getExternalDirectory() {
|
||||
return mPreferences.getBoolean(EXTERNAL_DIRECTORY, false);
|
||||
}
|
||||
|
||||
public List<CategoryInfo> getCategories() {
|
||||
String data = mPreferences.getString(CATEGORIES, null);
|
||||
if (data != null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue