diff options
-rw-r--r-- | src/github/daneren2005/dsub/activity/SubsonicActivity.java | 11 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/fragments/MainFragment.java | 4 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java index 0ac2aa19..f1833aa2 100644 --- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java +++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java @@ -375,8 +375,8 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte private void populateDrawer() {
SharedPreferences prefs = Util.getPreferences(this);
boolean podcastsEnabled = prefs.getBoolean(Constants.PREFERENCES_KEY_PODCASTS_ENABLED, true);
- boolean bookmarksEnabled = prefs.getBoolean(Constants.PREFERENCES_KEY_BOOKMARKS_ENABLED, true);
- boolean chatEnabled = prefs.getBoolean(Constants.PREFERENCES_KEY_CHAT_ENABLED, true);
+ boolean bookmarksEnabled = prefs.getBoolean(Constants.PREFERENCES_KEY_BOOKMARKS_ENABLED, true) && !Util.isOffline(this);
+ boolean chatEnabled = prefs.getBoolean(Constants.PREFERENCES_KEY_CHAT_ENABLED, true) && !Util.isOffline(this);
if(drawerItems == null || !enabledItems[0] == podcastsEnabled || !enabledItems[1] == bookmarksEnabled || !enabledItems[2] == chatEnabled) {
drawerItems = getResources().getStringArray(R.array.drawerItems);
@@ -567,6 +567,13 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte }
recreateSpinner();
}
+
+ public void invalidate() {
+ if(currentFragment != null) {
+ currentFragment.invalidate();
+ populateDrawer();
+ }
+ }
protected void recreateSpinner() {
if(backStack.size() > 0) {
diff --git a/src/github/daneren2005/dsub/fragments/MainFragment.java b/src/github/daneren2005/dsub/fragments/MainFragment.java index 803fa669..8aa465f7 100644 --- a/src/github/daneren2005/dsub/fragments/MainFragment.java +++ b/src/github/daneren2005/dsub/fragments/MainFragment.java @@ -195,14 +195,14 @@ public class MainFragment extends SubsonicFragment { service.clearIncomplete();
}
Util.setActiveServer(context, instance);
- this.invalidate();
+ context.invalidate();
}
}
private void toggleOffline() {
boolean isOffline = Util.isOffline(context);
Util.setOffline(context, !isOffline);
- this.invalidate();
+ context.invalidate();
if(isOffline) {
int scrobblesCount = Util.offlineScrobblesCount(context);
|