update preference utils for image cache
This commit is contained in:
parent
ffa0dffa26
commit
a69b0e80e0
7 changed files with 9 additions and 15 deletions
|
|
@ -23,7 +23,7 @@ public class CustomGlideModule implements GlideModule {
|
|||
@Override
|
||||
public void applyOptions(@NonNull Context context, GlideBuilder builder) {
|
||||
File file = new File(App.getInstance().getApplicationInfo().dataDir + "/glide");
|
||||
int size = PreferenceUtil.getInstance(context).getCacheSize();
|
||||
int size = PreferenceUtil.getInstance(context).getImageCacheSize();
|
||||
|
||||
builder.setDiskCache(new DiskLruCacheFactory(() -> file, size));
|
||||
builder.setDefaultRequestOptions(new RequestOptions().format(DecodeFormat.PREFER_RGB_565));
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class LoginActivity extends AbsBaseActivity implements View.OnClickListen
|
|||
if (v == binding.login) {
|
||||
final Context context = this;
|
||||
if (binding.server.getText().toString().trim().length() == 0) {
|
||||
Toast.makeText(context, context.getResources().getString(R.string.error_login_empty_addr), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(context, context.getResources().getString(R.string.error_login_empty_address), Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ public final class PreferenceUtil {
|
|||
public static final String REMEMBER_SHUFFLE = "remember_shuffle";
|
||||
public static final String REMEMBER_QUEUE = "remember_queue";
|
||||
|
||||
public static final String CACHE_SIZE = "cache_size";
|
||||
public static final String IMAGE_CACHE_SIZE = "image_cache_size";
|
||||
|
||||
private static PreferenceUtil sInstance;
|
||||
|
||||
|
|
@ -387,8 +387,8 @@ public final class PreferenceUtil {
|
|||
editor.apply();
|
||||
}
|
||||
|
||||
public final int getCacheSize() {
|
||||
return Integer.parseInt(mPreferences.getString(CACHE_SIZE, "400000000"));
|
||||
public final int getImageCacheSize() {
|
||||
return Integer.parseInt(mPreferences.getString(IMAGE_CACHE_SIZE, "400000000"));
|
||||
}
|
||||
|
||||
public List<CategoryInfo> getCategories() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue