aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-11-12 20:13:13 -0800
committerScott Jackson <daneren2005@gmail.com>2013-11-12 20:13:13 -0800
commitbeb6bf20cd1f29803405c252d851de586c960a85 (patch)
treece21a1349720ac117bf4b866f1127322f6474059 /src/github
parentc989c3973c3a947b5054bb0451aa44cedb941981 (diff)
downloaddsub-beb6bf20cd1f29803405c252d851de586c960a85.tar.gz
dsub-beb6bf20cd1f29803405c252d851de586c960a85.tar.bz2
dsub-beb6bf20cd1f29803405c252d851de586c960a85.zip
Don't show bookmark/chat tab while offline
Diffstat (limited to 'src/github')
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicActivity.java11
-rw-r--r--src/github/daneren2005/dsub/fragments/MainFragment.java4
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);