diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-06-23 17:30:02 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-06-23 17:30:02 -0700 |
commit | 7d0a8531f18ee6879ca8fff20ed3d20ccfeeb989 (patch) | |
tree | 130a3c200c8a81045a9cabc3dcd795466c485dd8 | |
parent | 15f72d307ca55d5aed6daa07198d8c782aa433a3 (diff) | |
download | dsub-7d0a8531f18ee6879ca8fff20ed3d20ccfeeb989.tar.gz dsub-7d0a8531f18ee6879ca8fff20ed3d20ccfeeb989.tar.bz2 dsub-7d0a8531f18ee6879ca8fff20ed3d20ccfeeb989.zip |
#305 Fix minor issues with permission changes
5 files changed, 15 insertions, 7 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java index 26b5dcc1..7aec30c4 100644 --- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java +++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java @@ -385,7 +385,7 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte 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) && !Util.isOffline(this);
- boolean sharedEnabled = prefs.getBoolean(Constants.PREFERENCES_KEY_SHARED_ENABLED, true) && !Util.isOffline(this) && UserUtil.canShare();
+ boolean sharedEnabled = prefs.getBoolean(Constants.PREFERENCES_KEY_SHARED_ENABLED, true) && !Util.isOffline(this);
boolean chatEnabled = prefs.getBoolean(Constants.PREFERENCES_KEY_CHAT_ENABLED, true) && !Util.isOffline(this);
boolean adminEnabled = prefs.getBoolean(Constants.PREFERENCES_KEY_ADMIN_ENABLED, true) && !Util.isOffline(this);
diff --git a/src/github/daneren2005/dsub/fragments/AdminFragment.java b/src/github/daneren2005/dsub/fragments/AdminFragment.java index 19aa4b95..5e14aff5 100644 --- a/src/github/daneren2005/dsub/fragments/AdminFragment.java +++ b/src/github/daneren2005/dsub/fragments/AdminFragment.java @@ -113,7 +113,9 @@ public class AdminFragment extends SelectListFragment<User> { public List<User> getObjects(MusicService musicService, boolean refresh, ProgressListener listener) throws Exception {
try {
// Will only work if user is admin
- return musicService.getUsers(refresh, context, listener);
+ List<User> users = musicService.getUsers(refresh, context, listener);
+ UserUtil.refreshCurrentUser(context);
+ return users;
} catch(SubsonicRESTException e) {
// Delete cached users if not allowed to get them
String s = Util.getRestUrl(context, null, false);
@@ -123,6 +125,8 @@ public class AdminFragment extends SelectListFragment<User> { List<User> users = new ArrayList<User>();
users.add(musicService.getUser(refresh, UserUtil.getCurrentUsername(context), context, listener));
+
+ UserUtil.refreshCurrentUser(context);
return users;
}
}
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index 03a742df..e372bf51 100644 --- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java @@ -1208,7 +1208,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter if(add) {
ImageView shareButton = (ImageView) header.findViewById(R.id.select_album_share);
- if(share != null || podcastId != null || !Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_MENU_SHARED, true) && !Util.isOffline(context) && UserUtil.canShare()) {
+ if(share != null || podcastId != null || !Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_MENU_SHARED, true) || Util.isOffline(context) || !UserUtil.canShare()) {
shareButton.setVisibility(View.GONE);
} else {
shareButton.setOnClickListener(new View.OnClickListener() {
diff --git a/src/github/daneren2005/dsub/fragments/SelectPodcastsFragment.java b/src/github/daneren2005/dsub/fragments/SelectPodcastsFragment.java index bc771e50..616af757 100644 --- a/src/github/daneren2005/dsub/fragments/SelectPodcastsFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectPodcastsFragment.java @@ -87,7 +87,7 @@ public class SelectPodcastsFragment extends SelectListFragment<PodcastChannel> { menu.removeItem(R.id.podcast_menu_stop_sync);
}
} else {
- inflater.inflate(R.menu_select_podcasts_context_offline, menu);
+ inflater.inflate(R.menu.select_podcasts_context_offline, menu);
}
recreateContextMenu(menu);
@@ -122,7 +122,7 @@ public class SelectPodcastsFragment extends SelectListFragment<PodcastChannel> { @Override
public int getOptionsMenu() {
- return (UserUtil.canPodcast() && !Util.isOffline()) ? R.menu.select_podcasts : R.menu.abstract_top_menu;
+ return (UserUtil.canPodcast() && !Util.isOffline(context)) ? R.menu.select_podcasts : R.menu.abstract_top_menu;
}
@Override
diff --git a/src/github/daneren2005/dsub/util/UserUtil.java b/src/github/daneren2005/dsub/util/UserUtil.java index 7c83cc91..2d42133f 100644 --- a/src/github/daneren2005/dsub/util/UserUtil.java +++ b/src/github/daneren2005/dsub/util/UserUtil.java @@ -43,6 +43,10 @@ public final class UserUtil { private static int instance = -1;
private static User currentUser;
+ public static void refreshCurrentUser(Context context) {
+ currentUser = null;
+ seedCurrentUser(context);
+ }
public static void seedCurrentUser(final Context context) {
// Only try to seed if online
if(Util.isOffline(context)) {
@@ -51,10 +55,10 @@ public final class UserUtil { }
final int instance = Util.getActiveServer(context);
- if(this.instance == instance && currentUser != null) {
+ if(UserUtil.instance == instance && currentUser != null) {
return;
} else {
- this.instance = instance;
+ UserUtil.instance = instance;
}
new SilentBackgroundTask<Void>(context) {
|