In debug builds, append "(Debug)" to provided route names.

This commit is contained in:
Felix Ableitner 2014-05-10 14:41:13 +02:00
parent 44064c25de
commit 1b9e2f0e49
3 changed files with 35 additions and 23 deletions

View file

@ -27,12 +27,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package com.github.nutomic.controldlna.localroute;
import java.util.ArrayList;
import android.content.Context;
import android.content.IntentFilter;
import android.content.IntentFilter.MalformedMimeTypeException;
import android.content.res.Resources;
import android.media.AudioManager;
import android.support.v7.media.MediaControlIntent;
import android.support.v7.media.MediaRouteDescriptor;
@ -42,6 +39,8 @@ import android.support.v7.media.MediaRouter;
import com.github.nutomic.controldlna.R;
import java.util.ArrayList;
/**
* MediaRouteProvider that details the local audio route with its
* controls to the system.
@ -83,8 +82,12 @@ final class Provider extends MediaRouteProvider {
public Provider(Context context) {
super(context);
String routeName = context.getString(R.string.local_device);
if (context.getPackageName().endsWith(".debug")) {
routeName = routeName + " (" + context.getString(R.string.debug) + ")";
}
MediaRouteDescriptor routeDescriptor = new MediaRouteDescriptor.Builder(
ROUTE_ID, context.getResources().getString(R.string.local_device))
ROUTE_ID, routeName)
.addControlFilters(CONTROL_FILTERS)
.setPlaybackType(MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE)
.setVolumeHandling(MediaRouter.RouteInfo.PLAYBACK_VOLUME_VARIABLE)

View file

@ -27,24 +27,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package com.github.nutomic.controldlna.upnp;
import java.util.Map.Entry;
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
import org.teleal.cling.android.AndroidUpnpService;
import org.teleal.cling.android.AndroidUpnpServiceImpl;
import org.teleal.cling.model.action.ActionInvocation;
import org.teleal.cling.model.message.UpnpResponse;
import org.teleal.cling.model.meta.Device;
import org.teleal.cling.model.meta.LocalDevice;
import org.teleal.cling.model.meta.RemoteDevice;
import org.teleal.cling.model.meta.StateVariableAllowedValueRange;
import org.teleal.cling.model.types.ServiceType;
import org.teleal.cling.model.types.UDN;
import org.teleal.cling.registry.Registry;
import org.teleal.cling.registry.RegistryListener;
import org.teleal.cling.support.renderingcontrol.callback.GetVolume;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
@ -61,6 +43,26 @@ import android.os.Messenger;
import android.os.RemoteException;
import android.util.Log;
import com.github.nutomic.controldlna.R;
import org.teleal.cling.android.AndroidUpnpService;
import org.teleal.cling.android.AndroidUpnpServiceImpl;
import org.teleal.cling.model.action.ActionInvocation;
import org.teleal.cling.model.message.UpnpResponse;
import org.teleal.cling.model.meta.Device;
import org.teleal.cling.model.meta.LocalDevice;
import org.teleal.cling.model.meta.RemoteDevice;
import org.teleal.cling.model.meta.StateVariableAllowedValueRange;
import org.teleal.cling.model.types.ServiceType;
import org.teleal.cling.model.types.UDN;
import org.teleal.cling.registry.Registry;
import org.teleal.cling.registry.RegistryListener;
import org.teleal.cling.support.renderingcontrol.callback.GetVolume;
import java.util.Map.Entry;
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
/**
* Allows UPNP playback from different apps by providing a proxy interface.
* You can communicate to this service via RemotePlayServiceBinder.
@ -246,9 +248,13 @@ public class RemotePlayService extends Service implements RegistryListener {
Message msg = Message.obtain(null, Provider.MSG_RENDERER_ADDED, 0, 0);
String routeName = device.getDetails().getFriendlyName();
if (getPackageName().endsWith(".debug")) {
routeName = routeName + " (" + getString(R.string.debug) + ")";
}
msg.getData().putParcelable("device", new Provider.Device(
device.getIdentity().getUdn().toString(),
device.getDetails().getFriendlyName(),
routeName,
device.getDisplayString(),
currentVolume,
maxVolume));

View file

@ -60,5 +60,8 @@
<!-- Title for the contact developer preference -->
<string name="contact_dev_title">Contact Developer</string>
<!-- Appended to all routes provided by a debug build -->
<string name="debug">Debug</string>
</resources>