summaryrefslogtreecommitdiff
path: root/vdrmanager
diff options
context:
space:
mode:
authorlado <herrlado@gmail.com>2011-10-30 22:45:01 +0100
committerlado <herrlado@gmail.com>2011-10-30 22:45:01 +0100
commit8837ae6597387880ee3b2c8343d4d4c2cb99eba9 (patch)
tree5240854ad22aac0055f11b33991f0210f0e1836e /vdrmanager
parent82e8247d5bf5cde64146b9cec947863903cd84e4 (diff)
downloadvdr-manager-8837ae6597387880ee3b2c8343d4d4c2cb99eba9.tar.gz
vdr-manager-8837ae6597387880ee3b2c8343d4d4c2cb99eba9.tar.bz2
cutom locale
Diffstat (limited to 'vdrmanager')
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java84
1 files changed, 78 insertions, 6 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
index 4431d4a..8497db7 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
@@ -1,7 +1,11 @@
package de.bjusystems.vdrmanager.data;
+import java.util.Locale;
+
import android.content.Context;
import android.content.SharedPreferences;
+import android.content.res.Configuration;
+import android.text.TextUtils;
import de.bjusystems.vdrmanager.R;
/**
@@ -123,6 +127,47 @@ public class Preferences {
*/
private String imdbUrl = "akas.imdb.com";
+
+ /**
+ * Connection timeout
+ */
+ private int connectionTimeout;
+
+ /**
+ * Read Timeout
+ */
+ private int readTimeout;
+
+ /**
+ * Timeout for a whole command run
+ */
+ private int timeout;
+
+
+ public int getConnectionTimeout() {
+ return connectionTimeout;
+ }
+
+ public int getReadTimeout() {
+ return readTimeout;
+ }
+
+ public int getTimeout() {
+ return timeout;
+ }
+
+ public void setConnectionTimeout(int connectionTimeout) {
+ this.connectionTimeout = connectionTimeout;
+ }
+
+ public void setReadTimeout(int readTimeout) {
+ this.readTimeout = readTimeout;
+ }
+
+ public void setTimeout(int timeout) {
+ this.timeout = timeout;
+ }
+
public String getImdbUrl() {
return imdbUrl;
}
@@ -520,10 +565,18 @@ 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.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(){
+ thePrefs = null;
+ }
+
/**
* Loads all preferences
*
@@ -533,15 +586,16 @@ 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);
}
}
@@ -615,4 +669,22 @@ public class Preferences {
}
return "h:mm a";
}
+
+ /**
+ * Set locale read from preferences to context.
+ *
+ * @param context
+ * {@link Context}
+ */
+ public static void setLocale(final Context context) {
+ final String lc = getString(context, R.string.gui_custom_locale_key, null);
+ if (TextUtils.isEmpty(lc)) {
+ return;
+ }
+ final Locale locale = new Locale(lc);
+ Locale.setDefault(locale);
+ final Configuration config = new Configuration();
+ config.locale = locale;
+ context.getResources().updateConfiguration(config, null);
+ }
}