Merge pull request #3213 from fabolhak/add_episode_cache_summary

add pref_episode_cache_summary
This commit is contained in:
H. Lehmann 2019-06-13 21:55:33 +02:00 committed by GitHub
commit 3331b663e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 24 deletions

View File

@ -464,15 +464,6 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
}
}
);
ui.findPreference(UserPreferences.PREF_EPISODE_CACHE_SIZE)
.setOnPreferenceChangeListener(
(preference, o) -> {
if (o instanceof String) {
setEpisodeCacheSizeText(UserPreferences.readEpisodeCacheSize((String) o));
}
return true;
}
);
}
private void setupNetworkScreen() {
@ -695,7 +686,6 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
setParallelDownloadsText(UserPreferences.getParallelDownloads());
break;
case R.xml.preferences_autodownload:
setEpisodeCacheSizeText(UserPreferences.getEpisodeCacheSize());
checkAutodownloadItemVisibility(UserPreferences.isEnableAutodownload());
break;
case R.xml.preferences_storage:
@ -942,20 +932,6 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
ui.findPreference(UserPreferences.PREF_PARALLEL_DOWNLOADS).setSummary(s);
}
private void setEpisodeCacheSizeText(int cacheSize) {
final Resources res = ui.getActivity().getResources();
String s;
if (cacheSize == res.getInteger(
R.integer.episode_cache_size_unlimited)) {
s = res.getString(R.string.pref_episode_cache_unlimited);
} else {
s = Integer.toString(cacheSize)
+ res.getString(R.string.episodes_suffix);
}
ui.findPreference(UserPreferences.PREF_EPISODE_CACHE_SIZE).setSummary(s);
}
private void setDataFolderText() {
File f = UserPreferences.getDataFolder(null);
if (f != null) {

View File

@ -14,6 +14,7 @@
android:entries="@array/episode_cache_size_entries"
android:key="prefEpisodeCacheSize"
android:title="@string/pref_episode_cache_title"
android:summary="@string/pref_episode_cache_summary"
android:entryValues="@array/episode_cache_size_values"
app:useStockLayout="true"/>
<ListPreference

View File

@ -449,6 +449,7 @@
<string name="pref_automatic_download_on_battery_sum">Allow automatic download when the battery is not charging</string>
<string name="pref_parallel_downloads_title">Parallel Downloads</string>
<string name="pref_episode_cache_title">Episode Cache</string>
<string name="pref_episode_cache_summary">Total number of downloaded episodes cached on the device. Automatic download will be suspended if this number is reached.</string>
<string name="pref_theme_title_light">Light</string>
<string name="pref_theme_title_dark">Dark</string>
<string name="pref_theme_title_trueblack">Black (AMOLED ready)</string>