mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2024-12-24 16:02:13 +01:00
getting preferences setup for different cleanup method
This commit is contained in:
parent
18e409523b
commit
057900bc1b
@ -366,7 +366,7 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
|
|||||||
public boolean onPreferenceChange(Preference preference, Object o) {
|
public boolean onPreferenceChange(Preference preference, Object o) {
|
||||||
if (o instanceof String) {
|
if (o instanceof String) {
|
||||||
int newValue = Integer.valueOf((String) o) * 1024 * 1024;
|
int newValue = Integer.valueOf((String) o) * 1024 * 1024;
|
||||||
if(newValue != UserPreferences.getImageCacheSize()) {
|
if (newValue != UserPreferences.getImageCacheSize()) {
|
||||||
AlertDialog.Builder dialog = new AlertDialog.Builder(ui.getActivity());
|
AlertDialog.Builder dialog = new AlertDialog.Builder(ui.getActivity());
|
||||||
dialog.setTitle(android.R.string.dialog_alert_title);
|
dialog.setTitle(android.R.string.dialog_alert_title);
|
||||||
dialog.setMessage(R.string.pref_restart_required);
|
dialog.setMessage(R.string.pref_restart_required);
|
||||||
@ -379,6 +379,7 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
buildEpisodeCleanupPreference();
|
||||||
buildSmartMarkAsPlayedPreference();
|
buildSmartMarkAsPlayedPreference();
|
||||||
buildAutodownloadSelectedNetworsPreference();
|
buildAutodownloadSelectedNetworsPreference();
|
||||||
setSelectedNetworksEnabled(UserPreferences
|
setSelectedNetworksEnabled(UserPreferences
|
||||||
@ -432,6 +433,26 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
|
|||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void buildEpisodeCleanupPreference() {
|
||||||
|
final Resources res = ui.getActivity().getResources();
|
||||||
|
|
||||||
|
ListPreference pref = (ListPreference) ui.findPreference(UserPreferences.PREF_EPISODE_CLEANUP);
|
||||||
|
String[] values = res.getStringArray(
|
||||||
|
R.array.episode_cleanup_values);
|
||||||
|
String[] entries = new String[values.length];
|
||||||
|
for (int x = 0; x < values.length; x++) {
|
||||||
|
int v = Integer.parseInt(values[x]);
|
||||||
|
if (v == 0) {
|
||||||
|
entries[x] = res.getString(R.string.episode_cleanup_immediately);
|
||||||
|
} else if (v == -1){
|
||||||
|
entries[x] = res.getString(R.string.episode_cleanup_never);
|
||||||
|
} else {
|
||||||
|
entries[x] = res.getQuantityString(R.plurals.time_days_quantified, v, v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pref.setEntries(entries);
|
||||||
|
}
|
||||||
|
|
||||||
private void buildSmartMarkAsPlayedPreference() {
|
private void buildSmartMarkAsPlayedPreference() {
|
||||||
final Resources res = ui.getActivity().getResources();
|
final Resources res = ui.getActivity().getResources();
|
||||||
|
|
||||||
|
@ -137,6 +137,15 @@
|
|||||||
android:key="prefMobileUpdate"
|
android:key="prefMobileUpdate"
|
||||||
android:summary="@string/pref_mobileUpdate_sum"
|
android:summary="@string/pref_mobileUpdate_sum"
|
||||||
android:title="@string/pref_mobileUpdate_title"/>
|
android:title="@string/pref_mobileUpdate_title"/>
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:defaultValue="3"
|
||||||
|
android:entries="@array/episode_cleanup_entries"
|
||||||
|
android:key="prefEpisodeCleanup"
|
||||||
|
android:title="@string/pref_episode_cleanup_title"
|
||||||
|
android:summary="@string/pref_episode_cleanup_summary"
|
||||||
|
android:entryValues="@array/episode_cache_size_values"/>
|
||||||
|
|
||||||
<de.danoeh.antennapod.preferences.CustomEditTextPreference
|
<de.danoeh.antennapod.preferences.CustomEditTextPreference
|
||||||
android:defaultValue="6"
|
android:defaultValue="6"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
|
@ -67,6 +67,7 @@ public class UserPreferences {
|
|||||||
// Network
|
// Network
|
||||||
public static final String PREF_UPDATE_INTERVAL = "prefAutoUpdateIntervall";
|
public static final String PREF_UPDATE_INTERVAL = "prefAutoUpdateIntervall";
|
||||||
public static final String PREF_MOBILE_UPDATE = "prefMobileUpdate";
|
public static final String PREF_MOBILE_UPDATE = "prefMobileUpdate";
|
||||||
|
public static final String PREF_EPISODE_CLEANUP = "prefEpisodeCleanup";
|
||||||
public static final String PREF_PARALLEL_DOWNLOADS = "prefParallelDownloads";
|
public static final String PREF_PARALLEL_DOWNLOADS = "prefParallelDownloads";
|
||||||
public static final String PREF_EPISODE_CACHE_SIZE = "prefEpisodeCacheSize";
|
public static final String PREF_EPISODE_CACHE_SIZE = "prefEpisodeCacheSize";
|
||||||
public static final String PREF_ENABLE_AUTODL = "prefEnableAutoDl";
|
public static final String PREF_ENABLE_AUTODL = "prefEnableAutoDl";
|
||||||
@ -217,6 +218,8 @@ public class UserPreferences {
|
|||||||
return prefs.getBoolean(PREF_FOLLOW_QUEUE, true);
|
return prefs.getBoolean(PREF_FOLLOW_QUEUE, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getEpisodeCleanupDays() { return Integer.valueOf(prefs.getString(PREF_EPISODE_CLEANUP, "3")); }
|
||||||
|
|
||||||
public static boolean shouldSkipRemoveFromQueue() { return prefs.getBoolean(PREF_SKIP_REMOVES, false); }
|
public static boolean shouldSkipRemoveFromQueue() { return prefs.getBoolean(PREF_SKIP_REMOVES, false); }
|
||||||
|
|
||||||
public static boolean isAutoDelete() {
|
public static boolean isAutoDelete() {
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
<item>100</item>
|
<item>100</item>
|
||||||
<item>@string/pref_episode_cache_unlimited</item>
|
<item>@string/pref_episode_cache_unlimited</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="episode_cache_size_values">
|
<string-array name="episode_cache_size_values">
|
||||||
<item>5</item>
|
<item>5</item>
|
||||||
<item>10</item>
|
<item>10</item>
|
||||||
@ -53,6 +54,24 @@
|
|||||||
<item>-1</item>
|
<item>-1</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="episode_cleanup_entries">
|
||||||
|
<item>@string/episode_cleanup_immediately</item>
|
||||||
|
<item>1</item>
|
||||||
|
<item>3</item>
|
||||||
|
<item>5</item>
|
||||||
|
<item>7</item>
|
||||||
|
<item>@string/episode_cleanup_never</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="episode_cleanup_values">
|
||||||
|
<item>0</item>
|
||||||
|
<item>1</item>
|
||||||
|
<item>3</item>
|
||||||
|
<item>5</item>
|
||||||
|
<item>7</item>
|
||||||
|
<item>-1</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
<string-array name="playback_speed_values">
|
<string-array name="playback_speed_values">
|
||||||
<item>0.5</item>
|
<item>0.5</item>
|
||||||
<item>0.6</item>
|
<item>0.6</item>
|
||||||
|
@ -86,6 +86,8 @@
|
|||||||
<string name="feed_auto_download_always">Always</string>
|
<string name="feed_auto_download_always">Always</string>
|
||||||
<string name="feed_auto_download_never">Never</string>
|
<string name="feed_auto_download_never">Never</string>
|
||||||
<string name="send_label">Send...</string>
|
<string name="send_label">Send...</string>
|
||||||
|
<string name="episode_cleanup_never">Never</string>
|
||||||
|
<string name="episode_cleanup_immediately">when not in queue</string>
|
||||||
|
|
||||||
<!-- 'Add Feed' Activity labels -->
|
<!-- 'Add Feed' Activity labels -->
|
||||||
<string name="feedurl_label">Feed URL</string>
|
<string name="feedurl_label">Feed URL</string>
|
||||||
@ -266,6 +268,8 @@
|
|||||||
<string name="queue_label">Queue</string>
|
<string name="queue_label">Queue</string>
|
||||||
<string name="services_label">Services</string>
|
<string name="services_label">Services</string>
|
||||||
<string name="flattr_label">Flattr</string>
|
<string name="flattr_label">Flattr</string>
|
||||||
|
<string name="pref_episode_cleanup_title">Episode Cleanup</string>
|
||||||
|
<string name="pref_episode_cleanup_summary">Episodes that aren\'t in the queue and aren\'t favorites should be eligible for removal if space is needed</string>
|
||||||
<string name="pref_pauseOnHeadsetDisconnect_sum">Pause playback when the headphones are disconnected</string>
|
<string name="pref_pauseOnHeadsetDisconnect_sum">Pause playback when the headphones are disconnected</string>
|
||||||
<string name="pref_unpauseOnHeadsetReconnect_sum">Resume playback when the headphones are reconnected</string>
|
<string name="pref_unpauseOnHeadsetReconnect_sum">Resume playback when the headphones are reconnected</string>
|
||||||
<string name="pref_followQueue_sum">Jump to next queue item when playback completes</string>
|
<string name="pref_followQueue_sum">Jump to next queue item when playback completes</string>
|
||||||
@ -417,6 +421,10 @@
|
|||||||
<item quantity="other">%d hours</item>
|
<item quantity="other">%d hours</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
|
|
||||||
|
<plurals name="time_days_quantified">
|
||||||
|
<item quantity="one">1 day</item>
|
||||||
|
<item quantity="other">%d days</item>
|
||||||
|
</plurals>
|
||||||
<!-- gpodder.net -->
|
<!-- gpodder.net -->
|
||||||
<string name="gpodnet_taglist_header">CATEGORIES</string>
|
<string name="gpodnet_taglist_header">CATEGORIES</string>
|
||||||
<string name="gpodnet_toplist_header">TOP PODCASTS</string>
|
<string name="gpodnet_toplist_header">TOP PODCASTS</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user