Changes to device names/descriptions that are displayed.

This commit is contained in:
Felix Ableitner 2014-02-28 11:09:23 +01:00
parent 6cab4b4d32
commit 9c315124e1
4 changed files with 13 additions and 15 deletions

View file

@ -35,7 +35,6 @@
<string name="album_art">Album Art</string>
<!-- MediaRouter strings -->
<string name="route_description">DLNA Playback</string>
<string name="upnp_route_provider_service">UPNP Route Provider Service</string>
</resources>

View file

@ -58,11 +58,9 @@ import android.util.Pair;
import android.util.SparseArray;
import android.widget.Toast;
import com.github.nutomic.controldlna.R;
/**
* Allows playing to a DLNA renderer from a remote app.
*
*
* @author Felix Ableitner
*/
final class Provider extends MediaRouteProvider {
@ -228,10 +226,8 @@ final class Provider extends MediaRouteProvider {
Builder builder = new Builder();
for (Entry<String, Device> d : mDevices.entrySet()) {
MediaRouteDescriptor routeDescriptor = new MediaRouteDescriptor.Builder(
d.getValue().id,
d.getValue().name)
.setDescription(getContext().getResources()
.getString(R.string.route_description))
d.getValue().id, d.getValue().name)
.setDescription(d.getValue().description)
.addControlFilters(CONTROL_FILTERS)
.setPlaybackType(MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE)
.setVolumeHandling(MediaRouter.RouteInfo.PLAYBACK_VOLUME_VARIABLE)

View file

@ -238,10 +238,11 @@ public class RemotePlayService extends Service implements RegistryListener {
}
Message msg = Message.obtain(null, Provider.MSG_RENDERER_ADDED, 0, 0);
msg.getData().putParcelable("device", new Provider.Device(
device.getIdentity().getUdn().toString(),
device.getDetails().getFriendlyName(),
device.getDisplayString(),
device.getDetails().getManufacturerDetails().getManufacturer(),
currentVolume,
maxVolume));
sendMessage(msg);

View file

@ -51,7 +51,7 @@ import com.github.nutomic.controldlna.R;
/**
* Displays the devices that are inserted through the RegistryListener (either
* of type RENDERER or SERVER).
*
*
* @author Felix Ableitner
*
*/
@ -84,10 +84,10 @@ public class DeviceArrayAdapter extends ArrayAdapter<Device<?, ?, ?>>
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.list_item, parent, false);
}
TextView tv = (TextView) convertView.findViewById(R.id.title);
RemoteImageView image =
(RemoteImageView) convertView.findViewById(R.id.image);
tv.setText(getItem(position).getDetails().getFriendlyName());
TextView title = (TextView) convertView.findViewById(R.id.title);
TextView subtitle = (TextView) convertView.findViewById(R.id.subtitle);
title.setText(getItem(position).getDetails().getFriendlyName());
subtitle.setText(getItem(position).getDisplayString());
if (getItem(position).hasIcons()) {
URI uri = getItem(position).getIcons()[0].getUri();
@ -98,7 +98,9 @@ public class DeviceArrayAdapter extends ArrayAdapter<Device<?, ?, ?>>
} catch (URISyntaxException e) {
Log.w(TAG, "Failed to get device icon URI", e);
}
image.setImageUri(uri);
RemoteImageView icon =
(RemoteImageView) convertView.findViewById(R.id.image);
icon.setImageUri(uri);
}
return convertView;