diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-07-01 19:18:09 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-07-01 19:18:09 -0700 |
commit | 02d76ce05cb6573a5cf98ed9068bb5af73f93c42 (patch) | |
tree | 46641b0c9ea6d97caa589667786f2e75802118e5 /src | |
parent | dd15c1d6c49c7bc74005083d9b1159823821d976 (diff) | |
download | dsub-02d76ce05cb6573a5cf98ed9068bb5af73f93c42.tar.gz dsub-02d76ce05cb6573a5cf98ed9068bb5af73f93c42.tar.bz2 dsub-02d76ce05cb6573a5cf98ed9068bb5af73f93c42.zip |
Fix force refreshing as admin not refreshing personal credentials
Diffstat (limited to 'src')
-rw-r--r-- | src/github/daneren2005/dsub/fragments/AdminFragment.java | 6 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/fragments/MainFragment.java | 2 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/util/UserUtil.java | 12 |
3 files changed, 13 insertions, 7 deletions
diff --git a/src/github/daneren2005/dsub/fragments/AdminFragment.java b/src/github/daneren2005/dsub/fragments/AdminFragment.java index 5a69534d..08a78fd6 100644 --- a/src/github/daneren2005/dsub/fragments/AdminFragment.java +++ b/src/github/daneren2005/dsub/fragments/AdminFragment.java @@ -114,7 +114,9 @@ public class AdminFragment extends SelectListFragment<User> { try {
// Will only work if user is admin
List<User> users = musicService.getUsers(refresh, context, listener);
- UserUtil.refreshCurrentUser(context);
+ if(refresh) {
+ UserUtil.refreshCurrentUser(context, true);
+ }
return users;
} catch(SubsonicRESTException e) {
// Delete cached users if not allowed to get them
@@ -126,7 +128,7 @@ 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);
+ UserUtil.refreshCurrentUser(context, false);
return users;
}
}
diff --git a/src/github/daneren2005/dsub/fragments/MainFragment.java b/src/github/daneren2005/dsub/fragments/MainFragment.java index c673fc12..fc86ad36 100644 --- a/src/github/daneren2005/dsub/fragments/MainFragment.java +++ b/src/github/daneren2005/dsub/fragments/MainFragment.java @@ -209,7 +209,7 @@ public class MainFragment extends SubsonicFragment { }
Util.setActiveServer(context, instance);
context.invalidate();
- UserUtil.refreshCurrentUser(context);
+ UserUtil.refreshCurrentUser(context, false);
}
}
diff --git a/src/github/daneren2005/dsub/util/UserUtil.java b/src/github/daneren2005/dsub/util/UserUtil.java index 435b2bd9..2d1b097a 100644 --- a/src/github/daneren2005/dsub/util/UserUtil.java +++ b/src/github/daneren2005/dsub/util/UserUtil.java @@ -46,11 +46,15 @@ public final class UserUtil { private static int instance = -1;
private static User currentUser;
- public static void refreshCurrentUser(Context context) {
+ public static void refreshCurrentUser(Context context, boolean forceRefresh) {
currentUser = null;
- seedCurrentUser(context);
+ seedCurrentUser(context, forceRefresh);
}
- public static void seedCurrentUser(final Context context) {
+
+ public static void seedCurrentUser(Context context) {
+ seedCurrentUser(context, false);
+ }
+ public static void seedCurrentUser(final Context context, final boolean refresh) {
// Only try to seed if online
if(Util.isOffline(context)) {
currentUser = null;
@@ -67,7 +71,7 @@ public final class UserUtil { new SilentBackgroundTask<Void>(context) {
@Override
protected Void doInBackground() throws Throwable {
- currentUser = MusicServiceFactory.getMusicService(context).getUser(false, getCurrentUsername(context, instance), context, null);
+ currentUser = MusicServiceFactory.getMusicService(context).getUser(refresh, getCurrentUsername(context, instance), context, null);
// If running, redo cast selector
DownloadService downloadService = DownloadService.getInstance();
|