use of com.connectsdk.service.NetcastTVService 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;
}
Aggregations