aboutsummaryrefslogtreecommitdiff
path: root/src/github/daneren2005
diff options
context:
space:
mode:
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r--src/github/daneren2005/dsub/activity/SettingsActivity.java17
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicActivity.java17
-rw-r--r--src/github/daneren2005/dsub/util/Util.java21
3 files changed, 23 insertions, 32 deletions
diff --git a/src/github/daneren2005/dsub/activity/SettingsActivity.java b/src/github/daneren2005/dsub/activity/SettingsActivity.java
index 91703f16..48f67dd5 100644
--- a/src/github/daneren2005/dsub/activity/SettingsActivity.java
+++ b/src/github/daneren2005/dsub/activity/SettingsActivity.java
@@ -472,22 +472,7 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
private void applyTheme() {
String activeTheme = Util.getTheme(this);
- if ("dark".equals(activeTheme)) {
- setTheme(R.style.Theme_DSub_Dark);
- } else if ("black".equals(activeTheme)) {
- setTheme(R.style.Theme_DSub_Black);
- } else if ("light".equals(activeTheme)) {
- setTheme(R.style.Theme_DSub_Light);
- } 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());
- }
+ Util.applyTheme(this, activeTheme);
}
private void setHideMedia(boolean hide) {
diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
index 7aec30c4..78589a44 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
@@ -629,22 +629,7 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
Util.setTheme(this, theme);
}
- if ("dark".equals(theme)) {
- setTheme(R.style.Theme_DSub_Dark);
- } else if ("black".equals(theme)) {
- setTheme(R.style.Theme_DSub_Black);
- } else if ("light".equals(theme)) {
- setTheme(R.style.Theme_DSub_Light);
- } 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());
- }
+ Util.applyTheme(this, theme);
}
private void applyFullscreen() {
fullScreen = Util.getPreferences(this).getBoolean(Constants.PREFERENCES_KEY_FULL_SCREEN, false);
diff --git a/src/github/daneren2005/dsub/util/Util.java b/src/github/daneren2005/dsub/util/Util.java
index 27bfa365..cea5813e 100644
--- a/src/github/daneren2005/dsub/util/Util.java
+++ b/src/github/daneren2005/dsub/util/Util.java
@@ -28,6 +28,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@@ -84,6 +85,7 @@ import java.lang.reflect.Method;
import java.security.MessageDigest;
import java.text.DecimalFormat;
import java.text.NumberFormat;
+import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -274,6 +276,25 @@ public final class Util {
editor.putString(Constants.PREFERENCES_KEY_THEME, theme);
editor.commit();
}
+
+ public static void applyTheme(Context context, String theme) {
+ if ("dark".equals(theme)) {
+ context.setTheme(R.style.Theme_DSub_Dark);
+ } else if ("black".equals(theme)) {
+ context.setTheme(R.style.Theme_DSub_Black);
+ } else if ("holo".equals(theme)) {
+ context.setTheme(R.style.Theme_DSub_Holo);
+ } else {
+ context.setTheme(R.style.Theme_DSub_Light);
+ }
+
+ SharedPreferences prefs = Util.getPreferences(context);
+ if(prefs.getBoolean(Constants.PREFERENCES_KEY_OVERRIDE_SYSTEM_LANGUAGE, false)) {
+ Configuration config = new Configuration();
+ config.locale = Locale.ENGLISH;
+ context.getResources().updateConfiguration(config, context.getResources().getDisplayMetrics());
+ }
+ }
public static boolean getDisplayTrack(Context context) {
SharedPreferences prefs = getPreferences(context);