diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-06-24 06:10:01 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-06-24 06:10:01 -0700 |
commit | 21102f1b654800704a0d3557bb35808cb17d49eb (patch) | |
tree | cbcd4643b092ec0b6edbbc05103157dc45dcad80 /src | |
parent | cd36c7449afb77d1016836105a33828cd0f8bc20 (diff) | |
download | dsub-21102f1b654800704a0d3557bb35808cb17d49eb.tar.gz dsub-21102f1b654800704a0d3557bb35808cb17d49eb.tar.bz2 dsub-21102f1b654800704a0d3557bb35808cb17d49eb.zip |
#305 Only show Jukebox as an option if have permissions
Diffstat (limited to 'src')
4 files changed, 16 insertions, 3 deletions
diff --git a/src/github/daneren2005/dsub/fragments/MainFragment.java b/src/github/daneren2005/dsub/fragments/MainFragment.java index 691000e3..c673fc12 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.seedCurrentUser(context);
+ UserUtil.refreshCurrentUser(context);
}
}
diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java index 99056ea2..7bf04936 100644 --- a/src/github/daneren2005/dsub/service/DownloadService.java +++ b/src/github/daneren2005/dsub/service/DownloadService.java @@ -561,6 +561,9 @@ public class DownloadService extends Service { } }); } + public void userSettingsChanged() { + mediaRouter.buildSelector(); + } public synchronized int size() { return downloadList.size(); diff --git a/src/github/daneren2005/dsub/util/MediaRouteManager.java b/src/github/daneren2005/dsub/util/MediaRouteManager.java index cad8afe3..347b0376 100644 --- a/src/github/daneren2005/dsub/util/MediaRouteManager.java +++ b/src/github/daneren2005/dsub/util/MediaRouteManager.java @@ -157,9 +157,11 @@ public class MediaRouteManager extends MediaRouter.Callback { addOfflineProviders(); } } - private void buildSelector() { + public void buildSelector() { MediaRouteSelector.Builder builder = new MediaRouteSelector.Builder(); - builder.addControlCategory(JukeboxRouteProvider.CATEGORY_JUKEBOX_ROUTE); + if(UserUtil.canJukebox()) { + builder.addControlCategory(JukeboxRouteProvider.CATEGORY_JUKEBOX_ROUTE); + } if(castAvailable) { builder.addControlCategory(CastCompat.getCastControlCategory()); } diff --git a/src/github/daneren2005/dsub/util/UserUtil.java b/src/github/daneren2005/dsub/util/UserUtil.java index 2d42133f..7a93f535 100644 --- a/src/github/daneren2005/dsub/util/UserUtil.java +++ b/src/github/daneren2005/dsub/util/UserUtil.java @@ -32,6 +32,7 @@ import java.io.File; import github.daneren2005.dsub.R;
import github.daneren2005.dsub.domain.User;
import github.daneren2005.dsub.fragments.SubsonicFragment;
+import github.daneren2005.dsub.service.DownloadService;
import github.daneren2005.dsub.service.MusicService;
import github.daneren2005.dsub.service.MusicServiceFactory;
import github.daneren2005.dsub.service.OfflineException;
@@ -65,6 +66,13 @@ public final class UserUtil { @Override
protected Void doInBackground() throws Throwable {
currentUser = MusicServiceFactory.getMusicService(context).getUser(false, getCurrentUsername(context, instance), context, null);
+
+ // If running, redo cast selector
+ DownloadService downloadService = DownloadService.getInstance();
+ if(downloadService != null) {
+ downloadService.userSettingsChanged();
+ }
+
return null;
}
|