diff options
author | lado <herrlado@gmail.com> | 2011-11-01 23:12:03 +0100 |
---|---|---|
committer | lado <herrlado@gmail.com> | 2011-11-01 23:12:03 +0100 |
commit | d04e865c9200a28545c3718a4256080b6eb6c8c9 (patch) | |
tree | 2a83f860a53b1e87ea710653fb33ec934842a02b /vdrmanager | |
parent | 5e3faf42847563ce058b73a80efeaecf89613355 (diff) | |
download | vdr-manager-d04e865c9200a28545c3718a4256080b6eb6c8c9.tar.gz vdr-manager-d04e865c9200a28545c3718a4256080b6eb6c8c9.tar.bz2 |
fix with Default language which did not work.
Diffstat (limited to 'vdrmanager')
-rw-r--r-- | vdrmanager/res/values-de/preferences.xml | 2 | ||||
-rw-r--r-- | vdrmanager/res/values/preferences.xml | 4 | ||||
-rw-r--r-- | vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java | 42 |
3 files changed, 30 insertions, 18 deletions
diff --git a/vdrmanager/res/values-de/preferences.xml b/vdrmanager/res/values-de/preferences.xml index 07734be..59fb6f3 100644 --- a/vdrmanager/res/values-de/preferences.xml +++ b/vdrmanager/res/values-de/preferences.xml @@ -113,7 +113,9 @@ </string-array> <string-array name="lang"> + <!-- <item>Voreinstellung</item> + --> <item>Englisch</item> <item>Deutsch</item> </string-array> diff --git a/vdrmanager/res/values/preferences.xml b/vdrmanager/res/values/preferences.xml index 45d0b34..f755f67 100644 --- a/vdrmanager/res/values/preferences.xml +++ b/vdrmanager/res/values/preferences.xml @@ -112,12 +112,16 @@ <item>imdb.pt</item> </string-array> <string-array name="lang_values"> + <!-- <item>DEFAULT</item> + --> <item>en</item> <item>de</item> </string-array> <string-array name="lang"> + <!-- <item>Default language</item> + --> <item>English</item> <item>German</item> </string-array> diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java index 259a894..f4e788a 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java @@ -17,7 +17,7 @@ import de.bjusystems.vdrmanager.R; public class Preferences { public static final String DEFAULT_LANGUAGE_VALUE = "DEFAULT"; - + private boolean ssl; /** SVDRP host name or ip */ private String svdrpHost; @@ -129,7 +129,6 @@ public class Preferences { */ private String imdbUrl = "akas.imdb.com"; - /** * Connection timeout */ @@ -139,13 +138,12 @@ public class Preferences { * Read Timeout */ private int readTimeout; - + /** * Timeout for a whole command run */ private int timeout; - - + public int getConnectionTimeout() { return connectionTimeout; } @@ -567,18 +565,19 @@ public class Preferences { R.string.qui_show_imdb_button_key, true); prefs.imdbUrl = getString(context, R.string.qui_imdb_url_key, "imdb.de"); - - prefs.connectionTimeout = getInt(context, R.string.vdr_conntimeout_key, 10); + + prefs.connectionTimeout = getInt(context, R.string.vdr_conntimeout_key, + 10); prefs.readTimeout = getInt(context, R.string.vdr_readtimeout_key, 10); prefs.timeout = getInt(context, R.string.vdr_timeout_key, 120); thePrefs = prefs; } - public static void reset(){ + public static void reset() { thePrefs = null; } - + /** * Loads all preferences * @@ -588,14 +587,14 @@ public class Preferences { */ public static void init(final Context context) { -// if (thePrefs != null) { -// return; -// } + // if (thePrefs != null) { + // return; + // } synchronized (Preferences.class) { -// if (thePrefs != null) { -// return; -// } + // if (thePrefs != null) { + // return; + // } initInternal(context); setLocale(context); } @@ -680,10 +679,17 @@ public class Preferences { */ public static void setLocale(final Context context) { String lc = getString(context, R.string.gui_custom_locale_key, DEFAULT_LANGUAGE_VALUE); - if(lc.equals(DEFAULT_LANGUAGE_VALUE)){ - return; + Locale locale = null; + if (lc.equals(DEFAULT_LANGUAGE_VALUE)) { + String lang = Locale.getDefault().toString(); + if (lang.startsWith("de")) { + locale = Locale.GERMAN; + } else { + locale = Locale.ENGLISH; + } + } else { + locale = new Locale(lc); } - Locale locale = new Locale(lc); final Configuration config = new Configuration(); config.locale = locale; context.getResources().updateConfiguration(config, null); |