From 9c315124e133912ceabebef63fe3754bff1ea370 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Fri, 28 Feb 2014 11:09:23 +0100 Subject: [PATCH] Changes to device names/descriptions that are displayed. --- res/values/strings.xml | 1 - .../github/nutomic/controldlna/upnp/Provider.java | 10 +++------- .../controldlna/upnp/RemotePlayService.java | 3 ++- .../controldlna/utility/DeviceArrayAdapter.java | 14 ++++++++------ 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index ea38649..51e3647 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -35,7 +35,6 @@ Album Art - DLNA Playback UPNP Route Provider Service diff --git a/src/com/github/nutomic/controldlna/upnp/Provider.java b/src/com/github/nutomic/controldlna/upnp/Provider.java index 4a37bad..347ed39 100644 --- a/src/com/github/nutomic/controldlna/upnp/Provider.java +++ b/src/com/github/nutomic/controldlna/upnp/Provider.java @@ -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 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) diff --git a/src/com/github/nutomic/controldlna/upnp/RemotePlayService.java b/src/com/github/nutomic/controldlna/upnp/RemotePlayService.java index ff080fa..27cfcff 100644 --- a/src/com/github/nutomic/controldlna/upnp/RemotePlayService.java +++ b/src/com/github/nutomic/controldlna/upnp/RemotePlayService.java @@ -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); diff --git a/src/com/github/nutomic/controldlna/utility/DeviceArrayAdapter.java b/src/com/github/nutomic/controldlna/utility/DeviceArrayAdapter.java index 2192844..b2586bc 100644 --- a/src/com/github/nutomic/controldlna/utility/DeviceArrayAdapter.java +++ b/src/com/github/nutomic/controldlna/utility/DeviceArrayAdapter.java @@ -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> .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> } 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;