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.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.os.Environment;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
|
@ -23,11 +22,9 @@ import java.io.File;
|
||||||
public class CustomGlideModule implements GlideModule {
|
public class CustomGlideModule implements GlideModule {
|
||||||
@Override
|
@Override
|
||||||
public void applyOptions(@NonNull Context context, GlideBuilder builder) {
|
public void applyOptions(@NonNull Context context, GlideBuilder builder) {
|
||||||
File file = PreferenceUtil.getInstance(context).getExternalDirectory()
|
File file = new File(App.getInstance().getApplicationInfo().dataDir + "/glide");
|
||||||
? new File(Environment.getExternalStorageDirectory() + "/Gelli/images")
|
|
||||||
: new File(App.getInstance().getApplicationInfo().dataDir + "/glide");
|
|
||||||
|
|
||||||
int size = PreferenceUtil.getInstance(context).getCacheSize();
|
int size = PreferenceUtil.getInstance(context).getCacheSize();
|
||||||
|
|
||||||
builder.setDiskCache(new DiskLruCacheFactory(() -> file, size));
|
builder.setDiskCache(new DiskLruCacheFactory(() -> file, size));
|
||||||
builder.setDefaultRequestOptions(new RequestOptions().format(DecodeFormat.PREFER_RGB_565));
|
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 REMEMBER_QUEUE = "remember_queue";
|
||||||
|
|
||||||
public static final String CACHE_SIZE = "cache_size";
|
public static final String CACHE_SIZE = "cache_size";
|
||||||
public static final String EXTERNAL_DIRECTORY = "external_directory";
|
|
||||||
|
|
||||||
private static PreferenceUtil sInstance;
|
private static PreferenceUtil sInstance;
|
||||||
|
|
||||||
|
|
@ -392,10 +391,6 @@ public final class PreferenceUtil {
|
||||||
return Integer.parseInt(mPreferences.getString(CACHE_SIZE, "400000000"));
|
return Integer.parseInt(mPreferences.getString(CACHE_SIZE, "400000000"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean getExternalDirectory() {
|
|
||||||
return mPreferences.getBoolean(EXTERNAL_DIRECTORY, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<CategoryInfo> getCategories() {
|
public List<CategoryInfo> getCategories() {
|
||||||
String data = mPreferences.getString(CATEGORIES, null);
|
String data = mPreferences.getString(CATEGORIES, null);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,6 @@
|
||||||
android:positiveButtonText="@null"
|
android:positiveButtonText="@null"
|
||||||
android:title="@string/pref_title_images_cache_size" />
|
android:title="@string/pref_title_images_cache_size" />
|
||||||
|
|
||||||
<com.kabouzeid.appthemehelper.common.prefs.supportv7.ATESwitchPreference
|
|
||||||
app:iconSpaceReserved="false"
|
|
||||||
android:defaultValue="false"
|
|
||||||
android:key="external_directory"
|
|
||||||
android:summary="@string/pref_summary_images_external_directory"
|
|
||||||
android:title="@string/pref_title_images_external_directory" />
|
|
||||||
|
|
||||||
</com.kabouzeid.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
|
</com.kabouzeid.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
|
||||||
|
|
||||||
</androidx.preference.PreferenceScreen>
|
</androidx.preference.PreferenceScreen>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue