From 42b0c5efd3f03431acfbc1cca348bb1b7b0d2194 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Wed, 2 Apr 2014 21:55:02 -0700 Subject: #326 Add override to always use english --- .../daneren2005/dsub/activity/SubsonicActivity.java | 21 +++++++++++++++------ src/github/daneren2005/dsub/util/Constants.java | 1 + 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'src/github/daneren2005') diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java index 62349480..fe477df8 100644 --- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java +++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java @@ -22,6 +22,7 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageInfo; +import android.content.res.Configuration; import android.content.res.TypedArray; import android.media.AudioManager; import android.os.Build; @@ -50,6 +51,13 @@ import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Spinner; +import java.io.File; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Locale; + import github.daneren2005.dsub.R; import github.daneren2005.dsub.fragments.SubsonicFragment; import github.daneren2005.dsub.service.DownloadService; @@ -59,12 +67,6 @@ import github.daneren2005.dsub.util.Util; import github.daneren2005.dsub.view.DrawerAdapter; import github.daneren2005.dsub.view.UpdateView; -import java.io.File; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - public class SubsonicActivity extends ActionBarActivity implements OnItemSelectedListener { private static final String TAG = SubsonicActivity.class.getSimpleName(); private static ImageLoader IMAGE_LOADER; @@ -631,6 +633,13 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte } else { setTheme(R.style.Theme_DSub_Holo); } + + SharedPreferences prefs = Util.getPreferences(this); + if(prefs.getBoolean(Constants.PREFERENCES_KEY_OVERRIDE_SYSTEM_LANGUAGE, false)) { + Configuration config = new Configuration(); + config.locale = Locale.ENGLISH; + getResources().updateConfiguration(config,getResources().getDisplayMetrics()); + } } private void applyFullscreen() { fullScreen = Util.getPreferences(this).getBoolean(Constants.PREFERENCES_KEY_FULL_SCREEN, false); diff --git a/src/github/daneren2005/dsub/util/Constants.java b/src/github/daneren2005/dsub/util/Constants.java index 20040f97..1b6ae833 100644 --- a/src/github/daneren2005/dsub/util/Constants.java +++ b/src/github/daneren2005/dsub/util/Constants.java @@ -139,6 +139,7 @@ public final class Constants { public static final String PREFERENCES_KEY_SHARED_ENABLED = "sharedEnabled"; public static final String PREFERENCES_KEY_BROWSE_TAGS = "browseTags"; public static final String PREFERENCES_KEY_OPEN_TO_LIBRARY = "openToLibrary"; + public static final String PREFERENCES_KEY_OVERRIDE_SYSTEM_LANGUAGE = "overrideSystemLanguage"; public static final String OFFLINE_SCROBBLE_COUNT = "scrobbleCount"; public static final String OFFLINE_SCROBBLE_ID = "scrobbleID"; -- cgit v1.2.3