summaryrefslogtreecommitdiffstats
path: root/media/java/android
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2012-06-11 15:15:10 -0700
committerAdam Powell <adamp@google.com>2012-06-11 19:28:48 -0700
commitae20ae1a8aaa013813c356ae1d9541ca7ff020ae (patch)
tree8b8b569088cae80a9a959808a25f7359086cf65e /media/java/android
parent68cefd201809372a547257a273b805cabbd0da68 (diff)
downloadframeworks_base-ae20ae1a8aaa013813c356ae1d9541ca7ff020ae.zip
frameworks_base-ae20ae1a8aaa013813c356ae1d9541ca7ff020ae.tar.gz
frameworks_base-ae20ae1a8aaa013813c356ae1d9541ca7ff020ae.tar.bz2
More MediaRouter features.
Add RemoteControlClient to user routes. This will allow the UI layered on top to access info about the remote volume channel associated with a user route. Add icons for user routes and route groups. Change-Id: I438aa60fc8c93f878ec7638897225738155f0746
Diffstat (limited to 'media/java/android')
-rw-r--r--media/java/android/media/MediaRouter.java67
1 files changed, 67 insertions, 0 deletions
diff --git a/media/java/android/media/MediaRouter.java b/media/java/android/media/MediaRouter.java
index 5a2389e..ec8efee 100644
--- a/media/java/android/media/MediaRouter.java
+++ b/media/java/android/media/MediaRouter.java
@@ -22,6 +22,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
+import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.util.Log;
@@ -492,6 +493,7 @@ public class MediaRouter {
int mSupportedTypes;
RouteGroup mGroup;
final RouteCategory mCategory;
+ Drawable mIcon;
RouteInfo(RouteCategory category) {
mCategory = category;
@@ -534,6 +536,16 @@ public class MediaRouter {
return mCategory;
}
+ /**
+ * Get the icon representing this route.
+ * This icon will be used in picker UIs if available.
+ *
+ * @return the icon representing this route or null if no icon is available
+ */
+ public Drawable getIconDrawable() {
+ return mIcon;
+ }
+
void setStatusInt(CharSequence status) {
if (!status.equals(mStatus)) {
mStatus = status;
@@ -564,6 +576,7 @@ public class MediaRouter {
* @see MediaRouter.RouteInfo
*/
public static class UserRouteInfo extends RouteInfo {
+ RemoteControlClient mRcc;
UserRouteInfo(RouteCategory category) {
super(category);
@@ -587,6 +600,40 @@ public class MediaRouter {
public void setStatus(CharSequence status) {
setStatusInt(status);
}
+
+ /**
+ * Set the RemoteControlClient responsible for reporting playback info for this
+ * user route.
+ *
+ * <p>If this route manages remote playback, the data exposed by this
+ * RemoteControlClient will be used to reflect and update information
+ * such as route volume info in related UIs.</p>
+ *
+ * @param rcc RemoteControlClient associated with this route
+ */
+ public void setRemoteControlClient(RemoteControlClient rcc) {
+ mRcc = rcc;
+ }
+
+ /**
+ * Set an icon that will be used to represent this route.
+ * The system may use this icon in picker UIs or similar.
+ *
+ * @param icon icon drawable to use to represent this route
+ */
+ public void setIconDrawable(Drawable icon) {
+ mIcon = icon;
+ }
+
+ /**
+ * Set an icon that will be used to represent this route.
+ * The system may use this icon in picker UIs or similar.
+ *
+ * @param icon Resource ID of an icon drawable to use to represent this route
+ */
+ public void setIconResource(int resId) {
+ setIconDrawable(sStatic.mResources.getDrawable(resId));
+ }
}
/**
@@ -695,6 +742,26 @@ public class MediaRouter {
return mRoutes.get(index);
}
+ /**
+ * Set an icon that will be used to represent this group.
+ * The system may use this icon in picker UIs or similar.
+ *
+ * @param icon icon drawable to use to represent this group
+ */
+ public void setIconDrawable(Drawable icon) {
+ mIcon = icon;
+ }
+
+ /**
+ * Set an icon that will be used to represent this group.
+ * The system may use this icon in picker UIs or similar.
+ *
+ * @param icon Resource ID of an icon drawable to use to represent this group
+ */
+ public void setIconResource(int resId) {
+ setIconDrawable(sStatic.mResources.getDrawable(resId));
+ }
+
void memberNameChanged(RouteInfo info, CharSequence name) {
mUpdateName = true;
routeUpdated();