Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5e2af59 authored by Adam Powell's avatar Adam Powell
Browse files

Update MediaRouteChooserDialog grouping UI

Move UserRouteInfo tag support to RouteInfo

Change-Id: Ia753924f8613462d5f74736be93a8d748689eef1
parent 90b9f84c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -11566,6 +11566,8 @@ package android.media {
    method public java.lang.CharSequence getName(android.content.Context);
    method public java.lang.CharSequence getStatus();
    method public int getSupportedTypes();
    method public java.lang.Object getTag();
    method public void setTag(java.lang.Object);
  }
  public static class MediaRouter.SimpleCallback extends android.media.MediaRouter.Callback {
@@ -11580,14 +11582,12 @@ package android.media {
  }
  public static class MediaRouter.UserRouteInfo extends android.media.MediaRouter.RouteInfo {
    method public java.lang.Object getTag();
    method public void setIconDrawable(android.graphics.drawable.Drawable);
    method public void setIconResource(int);
    method public void setName(java.lang.CharSequence);
    method public void setName(int);
    method public void setRemoteControlClient(android.media.RemoteControlClient);
    method public void setStatus(java.lang.CharSequence);
    method public void setTag(java.lang.Object);
  }
  public class MediaScannerConnection implements android.content.ServiceConnection {
+216 −322

File changed.

Preview size limit exceeded, changes collapsed.

+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
<com.android.internal.view.CheckableLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="?android:attr/listPreferredItemHeight"
              android:background="?android:attr/selectableItemBackground"
              android:gravity="center_vertical">

    <ImageView android:layout_width="56dp"
+25 −20
Original line number Diff line number Diff line
@@ -14,7 +14,11 @@
     limitations under the License.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:background="?android:attr/selectableItemBackground">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="?android:attr/listPreferredItemHeightSmall"
        android:background="#19ffffff"
@@ -37,3 +41,4 @@
            android:scaleType="center" />

    </LinearLayout>
</FrameLayout>
 No newline at end of file
+33 −25
Original line number Diff line number Diff line
@@ -271,9 +271,9 @@ public class MediaRouter {
        if (cat.isGroupable() && !(info instanceof RouteGroup)) {
            // Enforce that any added route in a groupable category must be in a group.
            final RouteGroup group = new RouteGroup(info.getCategory());
            group.addRoute(info);
            sStatic.mRoutes.add(group);
            dispatchRouteAdded(group);
            group.addRoute(info);

            info = group;
        } else {
@@ -552,6 +552,8 @@ public class MediaRouter {
        final RouteCategory mCategory;
        Drawable mIcon;

        private Object mTag;

        RouteInfo(RouteCategory category) {
            mCategory = category;
        }
@@ -621,6 +623,29 @@ public class MediaRouter {
            return mIcon;
        }

        /**
         * Set an application-specific tag object for this route.
         * The application may use this to store arbitrary data associated with the
         * route for internal tracking.
         *
         * <p>Note that the lifespan of a route may be well past the lifespan of
         * an Activity or other Context; take care that objects you store here
         * will not keep more data in memory alive than you intend.</p>
         *
         * @param tag Arbitrary, app-specific data for this route to hold for later use
         */
        public void setTag(Object tag) {
            mTag = tag;
        }

        /**
         * @return The tag object previously set by the application
         * @see #setTag(Object)
         */
        public Object getTag() {
            return mTag;
        }

        void setStatusInt(CharSequence status) {
            if (!status.equals(mStatus)) {
                mStatus = status;
@@ -652,7 +677,6 @@ public class MediaRouter {
     */
    public static class UserRouteInfo extends RouteInfo {
        RemoteControlClient mRcc;
        private Object mTag;

        UserRouteInfo(RouteCategory category) {
            super(category);
@@ -720,29 +744,6 @@ public class MediaRouter {
        public void setIconResource(int resId) {
            setIconDrawable(sStatic.mResources.getDrawable(resId));
        }

        /**
         * Set an application-specific tag object for this route.
         * The application may use this to store arbitrary data associated with the
         * route for internal tracking.
         *
         * <p>Note that the lifespan of a route may be well past the lifespan of
         * an Activity or other Context; take care that objects you store here
         * will not keep more data in memory alive than you intend.</p>
         *
         * @param tag Arbitrary, app-specific data for this route to hold for later use
         */
        public void setTag(Object tag) {
            mTag = tag;
        }

        /**
         * @return The tag object previously set by the application
         * @see #setTag(Object)
         */
        public Object getTag() {
            return mTag;
        }
    }

    /**
@@ -888,6 +889,12 @@ public class MediaRouter {
        void routeUpdated() {
            int types = 0;
            final int count = mRoutes.size();
            if (count == 0) {
                // Don't keep empty groups in the router.
                MediaRouter.removeRoute(this);
                return;
            }

            for (int i = 0; i < count; i++) {
                types |= mRoutes.get(i).mSupportedTypes;
            }
@@ -901,6 +908,7 @@ public class MediaRouter {
            final int count = mRoutes.size();
            for (int i = 0; i < count; i++) {
                final RouteInfo info = mRoutes.get(i);
                // TODO: There's probably a much more correct way to localize this.
                if (i > 0) sb.append(", ");
                sb.append(info.mName);
            }