diff options
Diffstat (limited to 'OpenKeychain/src/main')
5 files changed, 19 insertions, 13 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java index a244972fb..b6832a9c7 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java @@ -114,6 +114,11 @@ public final class Constants { public static final String DARK = "dark"; public static final String DEFAULT = Constants.Pref.Theme.LIGHT; } + + public static final class ProxyType { + public static final String TYPE_HTTP = "proxyHttp"; + public static final String TYPE_SOCKS = "proxySocks"; + } } /** diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java index 370511c4f..60d0e6ac1 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java @@ -286,16 +286,19 @@ public class Preferences { } public Proxy.Type getProxyType() { - final String typeHttp = mResources.getString(R.string.pref_proxy_type_value_http); - final String typeSocks = mResources.getString(R.string.pref_proxy_type_value_socks); + final String typeHttp = Pref.ProxyType.TYPE_HTTP; + final String typeSocks = Pref.ProxyType.TYPE_SOCKS; String type = mSharedPreferences.getString(Pref.PROXY_TYPE, typeHttp); - if (type.equals(typeHttp)) return Proxy.Type.HTTP; - else if (type.equals(typeSocks)) return Proxy.Type.SOCKS; - else { // shouldn't happen - Log.e(Constants.TAG, "Invalid Proxy Type in preferences"); - return null; + switch (type) { + case typeHttp: + return Proxy.Type.HTTP; + case typeSocks: + return Proxy.Type.SOCKS; + default: // shouldn't happen + Log.e(Constants.TAG, "Invalid Proxy Type in preferences"); + return null; } } diff --git a/OpenKeychain/src/main/res/values/arrays.xml b/OpenKeychain/src/main/res/values/arrays.xml index ef3970672..28b6fcd78 100644 --- a/OpenKeychain/src/main/res/values/arrays.xml +++ b/OpenKeychain/src/main/res/values/arrays.xml @@ -34,8 +34,8 @@ <item>@string/pref_proxy_type_choice_socks</item> </string-array> <string-array name="pref_proxy_type_values" translatable="false"> - <item>@string/pref_proxy_type_value_http</item> - <item>@string/pref_proxy_type_value_socks</item> + <item>"proxyHttp"</item> + <item>"proxySocks"</item> </string-array> <string-array name="rev_del_dialog_entries" translatable="true"> <item>@string/del_rev_dialog_choice_rev_upload</item> @@ -67,6 +67,6 @@ </string-array> <string-array name="theme_values" translatable="false"> <item>"dark"</item> - <item>"ligh"</item> + <item>"light"</item> </string-array> </resources> diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index 95850f2bd..ce77f197f 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -198,8 +198,6 @@ <!-- proxy type choices and values --> <string name="pref_proxy_type_choice_http">"HTTP"</string> <string name="pref_proxy_type_choice_socks">"SOCKS"</string> - <string name="pref_proxy_type_value_http">"proxyHttp"</string> - <string name="pref_proxy_type_value_socks">"proxySocks"</string> <!-- OrbotHelper strings --> <string name="orbot_ignore_tor">"Don\'t use Tor"</string> diff --git a/OpenKeychain/src/main/res/xml/proxy_prefs.xml b/OpenKeychain/src/main/res/xml/proxy_prefs.xml index 94e101cb6..d8e9d8b89 100644 --- a/OpenKeychain/src/main/res/xml/proxy_prefs.xml +++ b/OpenKeychain/src/main/res/xml/proxy_prefs.xml @@ -27,7 +27,7 @@ <ListPreference android:entries="@array/pref_proxy_type_entries" android:entryValues="@array/pref_proxy_type_values" - android:defaultValue="@string/pref_proxy_type_value_http" + android:defaultValue="proxyHttp" android:key="proxyType" android:persistent="true" android:title="@string/pref_proxy_type_title" /> |