aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-11-05 12:46:19 -0800
committerScott Jackson <daneren2005@gmail.com>2014-11-05 12:46:19 -0800
commit10c9ad416dafbe33f81746fdec1c48953ec71cee (patch)
treeff328901700547856ef09d7729fdcfab8599abb4 /src/github
parent00cb1123339b2e62891872efa867bcbe54760da3 (diff)
downloaddsub-10c9ad416dafbe33f81746fdec1c48953ec71cee.tar.gz
dsub-10c9ad416dafbe33f81746fdec1c48953ec71cee.tar.bz2
dsub-10c9ad416dafbe33f81746fdec1c48953ec71cee.zip
Modify DLNARouteController to require a DLNADevice
Diffstat (limited to 'src/github')
-rw-r--r--src/github/daneren2005/dsub/provider/DLNARouteProvider.java27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/github/daneren2005/dsub/provider/DLNARouteProvider.java b/src/github/daneren2005/dsub/provider/DLNARouteProvider.java
index d86ebf20..25cb14db 100644
--- a/src/github/daneren2005/dsub/provider/DLNARouteProvider.java
+++ b/src/github/daneren2005/dsub/provider/DLNARouteProvider.java
@@ -175,7 +175,13 @@ public class DLNARouteProvider extends MediaRouteProvider {
@Override
public RouteController onCreateRouteController(String routeId) {
- return new DLNARouteController(downloadService);
+ DLNADevice device = devices.get(routeId);
+ if(device == null) {
+ Log.w(TAG, "No device exists for " + routeId);
+ return null;
+ }
+
+ return new DLNARouteController(device);
}
private void deviceAdded(final Device device) {
@@ -213,15 +219,22 @@ public class DLNARouteProvider extends MediaRouteProvider {
if(device.getType().getType().equals("MediaRenderer") && device instanceof RemoteDevice) {
String id = device.getIdentity().getUdn().toString();
devices.remove(id);
- broadcastDescriptors();
+
+ // Make sure we do this on the main thread
+ downloadService.post(new Runnable() {
+ @Override
+ public void run() {
+ broadcastDescriptors();
+ }
+ });
}
}
private class DLNARouteController extends RouteController {
- private DownloadService downloadService;
+ private DLNADevice device;
- public DLNARouteController(DownloadService downloadService) {
- this.downloadService = downloadService;
+ public DLNARouteController(DLNADevice device) {
+ this.device = device;
}
@Override
@@ -241,8 +254,8 @@ public class DLNARouteProvider extends MediaRouteProvider {
@Override
public void onSelect() {
- downloadService.setRemoteEnabled(RemoteControlState.DLNA);
- controller = downloadService.getRemoteController();
+ // controller = new DLNAController(device);
+ downloadService.setRemoteEnabled(RemoteControlState.DLNA, controller);
}
@Override