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> <string name="album_art">Album Art</string>
<!-- MediaRouter strings --> <!-- MediaRouter strings -->
<string name="route_description">DLNA Playback</string>
<string name="upnp_route_provider_service">UPNP Route Provider Service</string> <string name="upnp_route_provider_service">UPNP Route Provider Service</string>
</resources> </resources>

View file

@ -58,8 +58,6 @@ import android.util.Pair;
import android.util.SparseArray; import android.util.SparseArray;
import android.widget.Toast; import android.widget.Toast;
import com.github.nutomic.controldlna.R;
/** /**
* Allows playing to a DLNA renderer from a remote app. * Allows playing to a DLNA renderer from a remote app.
* *
@ -228,10 +226,8 @@ final class Provider extends MediaRouteProvider {
Builder builder = new Builder(); Builder builder = new Builder();
for (Entry<String, Device> d : mDevices.entrySet()) { for (Entry<String, Device> d : mDevices.entrySet()) {
MediaRouteDescriptor routeDescriptor = new MediaRouteDescriptor.Builder( MediaRouteDescriptor routeDescriptor = new MediaRouteDescriptor.Builder(
d.getValue().id, d.getValue().id, d.getValue().name)
d.getValue().name) .setDescription(d.getValue().description)
.setDescription(getContext().getResources()
.getString(R.string.route_description))
.addControlFilters(CONTROL_FILTERS) .addControlFilters(CONTROL_FILTERS)
.setPlaybackType(MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE) .setPlaybackType(MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE)
.setVolumeHandling(MediaRouter.RouteInfo.PLAYBACK_VOLUME_VARIABLE) .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); Message msg = Message.obtain(null, Provider.MSG_RENDERER_ADDED, 0, 0);
msg.getData().putParcelable("device", new Provider.Device( msg.getData().putParcelable("device", new Provider.Device(
device.getIdentity().getUdn().toString(), device.getIdentity().getUdn().toString(),
device.getDetails().getFriendlyName(),
device.getDisplayString(), device.getDisplayString(),
device.getDetails().getManufacturerDetails().getManufacturer(),
currentVolume, currentVolume,
maxVolume)); maxVolume));
sendMessage(msg); sendMessage(msg);

View file

@ -84,10 +84,10 @@ public class DeviceArrayAdapter extends ArrayAdapter<Device<?, ?, ?>>
.getSystemService(Context.LAYOUT_INFLATER_SERVICE); .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.list_item, parent, false); convertView = inflater.inflate(R.layout.list_item, parent, false);
} }
TextView tv = (TextView) convertView.findViewById(R.id.title); TextView title = (TextView) convertView.findViewById(R.id.title);
RemoteImageView image = TextView subtitle = (TextView) convertView.findViewById(R.id.subtitle);
(RemoteImageView) convertView.findViewById(R.id.image); title.setText(getItem(position).getDetails().getFriendlyName());
tv.setText(getItem(position).getDetails().getFriendlyName()); subtitle.setText(getItem(position).getDisplayString());
if (getItem(position).hasIcons()) { if (getItem(position).hasIcons()) {
URI uri = getItem(position).getIcons()[0].getUri(); URI uri = getItem(position).getIcons()[0].getUri();
@ -98,7 +98,9 @@ public class DeviceArrayAdapter extends ArrayAdapter<Device<?, ?, ?>>
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
Log.w(TAG, "Failed to get device icon URI", 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; return convertView;