use of com.connectsdk.device.ConnectableDevice in project butter-android by butterproject.
the class BeamDeviceAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = LayoutInflater.from(context).inflate(R.layout.casting_dialog_listitem, parent, false);
holder = new ViewHolder(convertView);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
ConnectableDevice device = getItem(position);
int imgResource = R.drawable.ic_dlna;
Collection<DeviceService> services = device.getServices();
ArrayList<String> textServices = new ArrayList<>(services.size());
for (DeviceService service : services) {
if (service instanceof CastService) {
imgResource = R.drawable.ic_googlecast;
textServices.add("Google Cast");
} else if (service instanceof DLNAService) {
imgResource = R.drawable.ic_dlna;
textServices.add("DLNA");
} else if (service instanceof AirPlayService) {
imgResource = R.drawable.ic_airplay;
textServices.add("AirPlay");
} else if (service instanceof RokuService) {
imgResource = R.drawable.ic_dlna;
textServices.add("Roku");
} else if (service instanceof WebOSTVService) {
imgResource = R.drawable.ic_dlna;
textServices.add("webOS TV");
} else if (service instanceof NetcastTVService) {
imgResource = R.drawable.ic_dlna;
textServices.add("Netcast");
}
}
String serviceText;
if (textServices.size() == 0) {
serviceText = "Beaming Device";
} else {
serviceText = TextUtils.join(",", textServices);
}
holder.icon.setImageResource(imgResource);
holder.text1.setText(device.getFriendlyName());
holder.text2.setText(serviceText);
return convertView;
}
use of com.connectsdk.device.ConnectableDevice in project butter-android by butterproject.
the class NetcastTVService method getDIALService.
public DIALService getDIALService() {
if (dialService == null) {
DiscoveryManager discoveryManager = DiscoveryManager.getInstance();
ConnectableDevice device = discoveryManager.getAllDevices().get(serviceDescription.getIpAddress());
if (device != null) {
DIALService foundService = null;
for (DeviceService service : device.getServices()) {
if (DIALService.class.isAssignableFrom(service.getClass())) {
foundService = (DIALService) service;
break;
}
}
dialService = foundService;
}
}
return dialService;
}
use of com.connectsdk.device.ConnectableDevice in project butter-android by butterproject.
the class WebOSTVService method getDLNAService.
private DeviceService getDLNAService() {
Map<String, ConnectableDevice> allDevices = DiscoveryManager.getInstance().getAllDevices();
ConnectableDevice device = null;
DeviceService service = null;
if (allDevices != null && allDevices.size() > 0)
device = allDevices.get(this.serviceDescription.getIpAddress());
if (device != null)
service = device.getServiceByName("DLNA");
return service;
}
use of com.connectsdk.device.ConnectableDevice in project butter-android by butterproject.
the class BeamPlayerPresenterImpl method prepareBeamUi.
private void prepareBeamUi() {
try {
ConnectableDevice connectedDevice = beamManager.getConnectedDevice();
if (!connectedDevice.hasCapability(MediaControl.Position) || !connectedDevice.hasCapability(MediaControl.Seek) || !connectedDevice.hasCapability(MediaControl.Duration)) {
hasSeekControl = false;
view.hideSeekBar();
}
if (!connectedDevice.hasCapability(VolumeControl.Volume_Get) || !connectedDevice.hasCapability(VolumeControl.Volume_Set) || !connectedDevice.hasCapability(VolumeControl.Volume_Subscribe)) {
hasVolumeControl = false;
view.disableVolumePanel();
}
if (!connectedDevice.hasCapability(MediaControl.Pause)) {
view.disablePlayButton();
}
} catch (Exception e) {
// TODO: 3/25/17 This should be handled properly
view.showErrorMessage(R.string.unknown_error);
view.closeScreen();
}
}
use of com.connectsdk.device.ConnectableDevice in project butter-android by butterproject.
the class NetcastTVService method getDLNAService.
public DLNAService getDLNAService() {
if (dlnaService == null) {
DiscoveryManager discoveryManager = DiscoveryManager.getInstance();
ConnectableDevice device = discoveryManager.getAllDevices().get(serviceDescription.getIpAddress());
if (device != null) {
DLNAService foundService = null;
for (DeviceService service : device.getServices()) {
if (DLNAService.class.isAssignableFrom(service.getClass())) {
foundService = (DLNAService) service;
break;
}
}
dlnaService = foundService;
}
}
return dlnaService;
}
Aggregations