aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java17
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java17
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)) {