diff options
author | lado <herrlado@gmail.com> | 2011-12-28 23:04:15 +0100 |
---|---|---|
committer | lado <herrlado@gmail.com> | 2011-12-28 23:04:15 +0100 |
commit | e5f587141be10d9bce22453fae04a9555e63a56f (patch) | |
tree | 9a74c6bcc30ff0663f13f493375dba725ac68e70 /vdrmanager/src | |
parent | 014b12e63730979203d8238e93bf7095e8060735 (diff) | |
download | vdr-manager-e5f587141be10d9bce22453fae04a9555e63a56f.tar.gz vdr-manager-e5f587141be10d9bce22453fae04a9555e63a56f.tar.bz2 |
better locale handling
Diffstat (limited to 'vdrmanager/src')
5 files changed, 23 insertions, 6 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/app/VdrManagerApp.java b/vdrmanager/src/de/bjusystems/vdrmanager/app/VdrManagerApp.java index 12620d2..c89066b 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/app/VdrManagerApp.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/app/VdrManagerApp.java @@ -2,9 +2,11 @@ package de.bjusystems.vdrmanager.app; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import android.app.Activity; import android.app.Application; +import android.app.LocalActivityManager; import de.bjusystems.vdrmanager.data.Channel; import de.bjusystems.vdrmanager.data.EpgSearchParams; import de.bjusystems.vdrmanager.data.Event; @@ -25,6 +27,8 @@ public class VdrManagerApp extends Application { private Timer currentTimer; private Channel currentChannel; + public static final Locale SYSTEM_LOCALE = Locale.getDefault() ; + private VDR currentVDR; public VDR getCurrentVDR() { diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java index ec96eeb..4b7e319 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java @@ -17,6 +17,8 @@ import de.bjusystems.vdrmanager.R; public class Preferences { public static final String DEFAULT_LANGUAGE_VALUE = "DEFAULT"; + + public static final String PREFERENCE_FILE_NAME = "VDR-Manager"; private boolean ssl; /** SVDRP host name or ip */ @@ -447,7 +449,7 @@ public class Preferences { * @return filename */ public static String getPreferenceFile(final Context context) { - return context.getString(R.string.app_name); + return PREFERENCE_FILE_NAME; } /** @@ -706,13 +708,16 @@ public class Preferences { public static void setLocale(final Context context) { String lc = getString(context, R.string.gui_custom_locale_key, DEFAULT_LANGUAGE_VALUE); Locale locale = null; + //TODO lado this is very bad. if (lc.equals(DEFAULT_LANGUAGE_VALUE)) { String lang = Locale.getDefault().toString(); if (lang.startsWith("de")) { locale = Locale.GERMAN; + } else if(lang.startsWith("it")){ + locale = Locale.ITALIAN; } else { locale = Locale.ENGLISH; - } + } } else { locale = new Locale(lc); } diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java index 64726d9..e65f2eb 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java @@ -64,7 +64,8 @@ public abstract class BaseActivity<Result, T extends ListView> extends Activity @Override protected void onResume() { - Preferences.init(this); + Preferences.setLocale(this); + //Preferences.init(this); super.onResume(); } diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java index 3a23008..3a225cd 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java @@ -58,8 +58,8 @@ public class EpgSearchListActivity extends BaseTimerEditActivity<Epg> implements } @Override protected void onCreate(final Bundle savedInstanceState) { - - Preferences.init(this); + Preferences.setLocale(this); + //Preferences.init(this); super.onCreate(savedInstanceState); diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java index 87f960e..8a05778 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java @@ -18,11 +18,12 @@ public class VdrManagerActivity extends Activity implements OnClickListener { @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); - Preferences.setLocale(this); + setTitle(getString(R.string.app_name)); // attach view setContentView(R.layout.vdrmanager); + // Preferences.loadPreferences(this); findViewById(R.id.action_menu_channels).setOnClickListener(this); @@ -49,6 +50,12 @@ public class VdrManagerActivity extends Activity implements OnClickListener { inflater.inflate(R.menu.main_menu, menu); return true; } + + @Override + protected void onResume() { + Preferences.setLocale(this); + super.onResume(); + } @Override public boolean onOptionsItemSelected(final MenuItem item) { |