Moved update interval preference strings into strings.xml. Fixes #182
This commit is contained in:
parent
cb2e5f14ab
commit
e734097ea9
|
@ -1,16 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string-array name="update_intervall_options">
|
||||
<item>Manual</item>
|
||||
<item>1 hour</item>
|
||||
<item>2 hours</item>
|
||||
<item>4 hours</item>
|
||||
<item>8 hours</item>
|
||||
<item>12 hours</item>
|
||||
<item>24 hours</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="update_intervall_values">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
|
@ -20,7 +10,6 @@
|
|||
<item>12</item>
|
||||
<item>24</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="episode_cache_size_entries">
|
||||
<item>@string/pref_episode_cache_unlimited</item>
|
||||
<item>10</item>
|
||||
|
@ -30,7 +19,6 @@
|
|||
<item>80</item>
|
||||
<item>100</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="episode_cache_size_values">
|
||||
<item>-1</item>
|
||||
<item>10</item>
|
||||
|
@ -40,20 +28,16 @@
|
|||
<item>80</item>
|
||||
<item>100</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="autodl_select_networks_default_entries">
|
||||
<item>N/A</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="autodl_select_networks_default_values">
|
||||
<item>0</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="theme_options">
|
||||
<item>@string/pref_theme_title_light</item>
|
||||
<item>@string/pref_theme_title_dark</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="theme_values">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
|
|
|
@ -182,6 +182,10 @@
|
|||
<string name="pref_theme_title_light">Light</string>
|
||||
<string name="pref_theme_title_dark">Dark</string>
|
||||
<string name="pref_episode_cache_unlimited">Unlimited</string>
|
||||
<string name="pref_update_interval_hours_plural">hours</string>
|
||||
<string name="pref_update_interval_hours_singular">hour</string>
|
||||
<string name="pref_update_interval_hours_manual">Manual</string>
|
||||
|
||||
|
||||
<!-- Search -->
|
||||
<string name="search_hint">Search for Feeds or Episodes</string>
|
||||
|
@ -244,4 +248,4 @@
|
|||
<string name="folder_not_empty_dialog_msg">The folder you have selected is not empty. Media downloads and other files will be placed directly in this folder. Continue anyway?</string>
|
||||
<string name="set_to_default_folder">Choose default folder</string>
|
||||
|
||||
</resources>
|
||||
</resources>
|
|
@ -22,7 +22,7 @@
|
|||
<PreferenceCategory android:title="@string/network_pref" >
|
||||
<ListPreference
|
||||
android:defaultValue="0"
|
||||
android:entries="@array/update_intervall_options"
|
||||
android:entries="@array/update_intervall_values"
|
||||
android:entryValues="@array/update_intervall_values"
|
||||
android:key="prefAutoUpdateIntervall"
|
||||
android:summary="@string/pref_autoUpdateIntervall_sum"
|
||||
|
|
|
@ -12,6 +12,7 @@ import android.net.wifi.WifiConfiguration;
|
|||
import android.net.wifi.WifiManager;
|
||||
import android.os.Bundle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.Preference.OnPreferenceChangeListener;
|
||||
import android.preference.Preference.OnPreferenceClickListener;
|
||||
|
@ -166,13 +167,40 @@ public class PreferenceActivity extends SherlockPreferenceActivity {
|
|||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
buildUpdateIntervalPreference();
|
||||
buildAutodownloadSelectedNetworsPreference();
|
||||
setSelectedNetworksEnabled(UserPreferences
|
||||
.isEnableAutodownloadWifiFilter());
|
||||
|
||||
}
|
||||
|
||||
private void buildUpdateIntervalPreference() {
|
||||
ListPreference pref = (ListPreference) findPreference(UserPreferences.PREF_UPDATE_INTERVAL);
|
||||
String[] values = getResources().getStringArray(
|
||||
R.array.update_intervall_values);
|
||||
String[] entries = new String[values.length];
|
||||
for (int x = 0; x < values.length; x++) {
|
||||
Integer v = Integer.parseInt(values[x]);
|
||||
switch (v) {
|
||||
case 0:
|
||||
entries[x] = getString(R.string.pref_update_interval_hours_manual);
|
||||
break;
|
||||
case 1:
|
||||
entries[x] = v
|
||||
+ " "
|
||||
+ getString(R.string.pref_update_interval_hours_singular);
|
||||
break;
|
||||
default:
|
||||
entries[x] = v + " "
|
||||
+ getString(R.string.pref_update_interval_hours_plural);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
pref.setEntries(entries);
|
||||
|
||||
}
|
||||
|
||||
private void setSelectedNetworksEnabled(boolean b) {
|
||||
if (selectedNetworks != null) {
|
||||
for (Preference p : selectedNetworks) {
|
||||
|
|
Loading…
Reference in New Issue