update preference utils for image cache

This commit is contained in:
dkanada 2020-10-15 22:37:27 +09:00
commit a69b0e80e0
7 changed files with 9 additions and 15 deletions

View file

@ -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));

View file

@ -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;
}

View file

@ -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() {

View file

@ -158,8 +158,6 @@
<string name="pref_title_remember_queue">Warteschlange merken</string>
<string name="pref_title_page_size">Maximale Listengröße</string>
<string name="pref_title_images_cache_size">Cache-Größe</string>
<string name="pref_title_images_external_directory">Externes Verzeichnis</string>
<string name="pref_summary_images_external_directory">"Bildcache in externem Verzeichnis speichern, um die Dateien zwischen Installationen aufzubewahren. "</string>
<string name="pref_summary_remember_queue">Warteschlange beim Schließen der Anwendung speichen, damit sie über Sitzungen hinweg bestehen bleibt.</string>
<string name="source">Quellcode</string>
<string name="report_bugs">Melde Fehler</string>

View file

@ -140,7 +140,7 @@
<string name="sort_method_year">Année</string>
<string name="error_unreachable_server">Impossible de contacter le serveur.</string>
<string name="error_login_credentials">Identifiants de connexion invalides.</string>
<string name="error_login_empty_addr">Veuillez saisir l\'adresse du serveur.</string>
<string name="error_login_empty_address">Veuillez saisir l\'adresse du serveur.</string>
<string name="error_unexpected">Une erreur inattendue s\'est produite.</string>
<string name="action_add_to_playlist">Ajouter à une playlist</string>
<string name="action_add_to_queue">Ajouter à la liste de lecture</string>
@ -161,11 +161,9 @@
<string name="logout">Déconnexion</string>
<string name="name">Nom</string>
<string name="pref_header_images">Images</string>
<string name="pref_summary_images_external_directory">Stocke le cache d\'images dans un dossier externe pour les conserver entre différentes installations.</string>
<string name="pref_summary_remember_queue">Enregistrer la liste de lecture à la fermeture de l\'application pour la conserver entre différentes utilisations.</string>
<string name="pref_summary_remember_shuffle">Le mode aléatoire sera conservé au choix d\'une nouvelle liste de titres pour la liste de lecture.</string>
<string name="pref_title_images_cache_size">Taille du cache</string>
<string name="pref_title_images_external_directory">Dossier externe</string>
<string name="pref_title_maximum_bitrate">Débit maximum</string>
<string name="pref_title_page_size">Taile de liste maximum</string>
<string name="pref_title_remember_queue">Se souvenir de la dernière liste de lecture</string>

View file

@ -124,9 +124,7 @@
<string name="pref_title_remember_queue">Remember Queue</string>
<string name="pref_title_page_size">Page Size</string>
<string name="pref_title_images_cache_size">Cache Size</string>
<string name="pref_title_images_external_directory">External Directory</string>
<string name="pref_summary_images_external_directory">Store the image cache in an external directory to keep the files between installs.</string>
<string name="primary_color_desc">The primary theme color for control elements.</string>
<string name="accent_color_desc">An alternate color used to accent elements.</string>
<string name="pref_summary_album_art_on_lockscreen">Uses the current song\'s album cover as the lock screen wallpaper.</string>
@ -200,7 +198,7 @@
<string name="playlist_is_empty">Playlist is empty</string>
<string name="playing_notification_description">The playing notification provides actions for play/pause etc.</string>
<string name="playing_notification_name">Playing notification</string>
<string name="playing_notification_name">Playing Notification</string>
<string name="you_have_to_select_at_least_one_category">You have to select at least one category.</string>
<string name="permissions_denied">Permissions denied.</string>
<string name="permission_external_storage_denied">Permission to access external storage denied.</string>
@ -221,7 +219,7 @@
<string name="sleep_timer_set">Sleep timer set for %d minutes from now.</string>
<string name="error_unreachable_server">Can\'t reach server.</string>
<string name="error_login_credentials">Invalid login credentials.</string>
<string name="error_login_empty_addr">Please fill in the server address.</string>
<string name="error_login_empty_address">Please fill in the server address.</string>
<string name="error_unexpected">An unexpected error occurred.</string>
<string name="error_no_username">Please fill in your username.</string>

View file

@ -9,7 +9,7 @@
android:defaultValue="400000000"
android:entries="@array/pref_images_cache_size_titles"
android:entryValues="@array/pref_images_cache_size_values"
android:key="cache_size"
android:key="image_cache_size"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:title="@string/pref_title_images_cache_size" />