diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-04-02 21:55:02 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-04-02 21:55:02 -0700 |
commit | 42b0c5efd3f03431acfbc1cca348bb1b7b0d2194 (patch) | |
tree | 0bcd37b9ce3604759aa255b5d8395cc7d22ca52d | |
parent | d28822f34ce40785d24bcd1450f10aa99c851e28 (diff) | |
download | dsub-42b0c5efd3f03431acfbc1cca348bb1b7b0d2194.tar.gz dsub-42b0c5efd3f03431acfbc1cca348bb1b7b0d2194.tar.bz2 dsub-42b0c5efd3f03431acfbc1cca348bb1b7b0d2194.zip |
#326 Add override to always use english
-rw-r--r-- | res/values/strings.xml | 2 | ||||
-rw-r--r-- | res/xml/settings.xml | 6 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/activity/SubsonicActivity.java | 21 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/util/Constants.java | 1 |
4 files changed, 24 insertions, 6 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index 59557509..b54a705e 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -397,6 +397,8 @@ <string name="settings.menu_options.shared_summary">Show Share in menus</string>
<string name="settings.browse_by_tags">Browse By Tags</string>
<string name="settings.browse_by_tags_summary">Browse by tags instead of by folder structure. Requires Subsonic 4.7+</string>
+ <string name="settings.override_system_language">Override System Language</string>
+ <string name="settings.override_system_language_summary">Display app in english even if the system language is something DSub has a translation for. May need to clear the app from memory for changes to take affect.</string>
<string name="shuffle.title">Shuffle By</string>
<string name="shuffle.startYear">Start Year:</string>
diff --git a/res/xml/settings.xml b/res/xml/settings.xml index 749fc100..55f06598 100644 --- a/res/xml/settings.xml +++ b/res/xml/settings.xml @@ -61,6 +61,12 @@ android:key="openToLibrary" android:defaultValue="false"/> + <CheckBoxPreference + android:title="@string/settings.override_system_language" + android:summary="@string/settings.override_system_language_summary" + android:key="overrideSystemLanguage" + android:defaultValue="false"/> + </PreferenceCategory> <PreferenceCategory 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"; |