diff options
author | Scott Jackson <daneren2005@gmail.com> | 2012-09-11 22:22:53 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2012-09-11 22:22:53 -0700 |
commit | 18c89bd0488e4b8b33e425b704c890b717b7a5de (patch) | |
tree | 43f42184b6f7a7a43beb91396bb0b2392d84a600 /subsonic-android/src | |
parent | 5eadac48eb97f7480e2629e46a6159cdcb21e1a2 (diff) | |
download | dsub-18c89bd0488e4b8b33e425b704c890b717b7a5de.tar.gz dsub-18c89bd0488e4b8b33e425b704c890b717b7a5de.tar.bz2 dsub-18c89bd0488e4b8b33e425b704c890b717b7a5de.zip |
Make sure to apply theme if changed from settings from any tab (previously only worked from main tab)
Diffstat (limited to 'subsonic-android/src')
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java | 17 | ||||
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java | 17 |
2 files changed, 15 insertions, 19 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java index 60532868..2fab77e7 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java @@ -53,8 +53,6 @@ public class MainActivity extends SubsonicTabActivity { private static final int MENU_ITEM_SERVER_3 = 103; private static final int MENU_ITEM_OFFLINE = 104; - private String theme; - private static boolean infoDialogDisplayed; /** @@ -120,10 +118,6 @@ public class MainActivity extends SubsonicTabActivity { // Title: Subsonic setTitle(R.string.common_appname); - - // Remember the current theme. - theme = Util.getTheme(this); - showInfoDialog(); } @@ -178,11 +172,6 @@ public class MainActivity extends SubsonicTabActivity { @Override protected void onResume() { super.onResume(); - - // Restart activity if theme has changed. - if (theme != null && !theme.equals(Util.getTheme(this))) { - restart(); - } } @Override @@ -246,12 +235,6 @@ public class MainActivity extends SubsonicTabActivity { } } - private void restart() { - Intent intent = new Intent(this, MainActivity.class); - intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - Util.startActivityWithoutTransition(this, intent); - } - private void exit() { stopService(new Intent(this, DownloadServiceImpl.class)); finish(); diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java index 49b3e2d8..8d388347 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java @@ -57,6 +57,7 @@ public class SubsonicTabActivity extends SherlockActivity { private static final String TAG = SubsonicTabActivity.class.getSimpleName(); private static ImageLoader IMAGE_LOADER; + private String theme; private boolean destroyed; private View homeButton; @@ -131,7 +132,12 @@ public class SubsonicTabActivity extends SherlockActivity { @Override protected void onResume() { super.onResume(); - Util.registerMediaButtonEventReceiver(this); + Util.registerMediaButtonEventReceiver(this); + + // Make sure to update theme + if (theme != null && !theme.equals(Util.getTheme(this))) { + restart(); + } } @Override @@ -155,6 +161,13 @@ public class SubsonicTabActivity extends SherlockActivity { } return super.onKeyDown(keyCode, event); } + + protected void restart() { + Intent intent = new Intent(this, this.getClass()); + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent.putExtras(getIntent()); + Util.startActivityWithoutTransition(this, intent); + } @Override public void finish() { @@ -163,7 +176,7 @@ public class SubsonicTabActivity extends SherlockActivity { } private void applyTheme() { - String theme = Util.getTheme(this); + theme = Util.getTheme(this); if ("dark".equals(theme)) { setTheme(R.style.Theme_DSub_Dark); } else if ("light".equals(theme)) { |