diff options
-rw-r--r-- | AndroidManifest.xml | 2 | ||||
-rw-r--r-- | res/xml/settings.xml | 2 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/activity/SettingsActivity.java | 17 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/activity/SubsonicActivity.java | 17 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/util/Util.java | 21 |
5 files changed, 25 insertions, 34 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 7caac225..0eb73517 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -32,7 +32,7 @@ <application android:label="@string/common.appname"
android:backupAgent="github.daneren2005.dsub.util.SettingsBackupAgent"
android:icon="@drawable/launch"
- android:theme="@style/Theme.DSub.Holo">
+ android:theme="@style/Theme.DSub.Light">
<activity android:name="github.daneren2005.dsub.activity.SubsonicFragmentActivity"
android:configChanges="orientation|keyboardHidden"
diff --git a/res/xml/settings.xml b/res/xml/settings.xml index 4e385145..42b74aa0 100644 --- a/res/xml/settings.xml +++ b/res/xml/settings.xml @@ -27,7 +27,7 @@ <ListPreference android:title="@string/settings.theme_title" android:key="theme" - android:defaultValue="holo" + android:defaultValue="light" android:entryValues="@array/themeValues" android:entries="@array/themeNames"/> 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); |