Merge "MediaRouter: New color scheme for main and group media controls" into mnc-ub-dev
diff --git a/v14/preference/NOTICES.md b/v14/preference/NOTICES.md
new file mode 100644
index 0000000..a390782
--- /dev/null
+++ b/v14/preference/NOTICES.md
@@ -0,0 +1,11 @@
+# Change Log
+
+## [23.1.0](https://android.googlesource.com/platform/frameworks/support/+/refs/heads/master/v14/preference) (2015-09-28)
+
+**Breakage and deprecation notices:**
+
+- EditTextPreferenceDialogFragment
+  - onAddEditTextToDialogView has been removed. Any code depending on overriding this method should
+    be moved to onBindDialogView.
+  - The EditText view is now expected to be present in the dialog layout file with the id
+    @android:id/edit, and is no longer created in code.
diff --git a/v7/mediarouter/res/drawable-hdpi/ic_cast_grey.png b/v7/mediarouter/res/drawable-hdpi/ic_cast_grey.png
new file mode 100644
index 0000000..f0960f8
--- /dev/null
+++ b/v7/mediarouter/res/drawable-hdpi/ic_cast_grey.png
Binary files differ
diff --git a/v7/mediarouter/res/drawable-hdpi/ic_cast_white.png b/v7/mediarouter/res/drawable-hdpi/ic_cast_white.png
new file mode 100644
index 0000000..60d3915
--- /dev/null
+++ b/v7/mediarouter/res/drawable-hdpi/ic_cast_white.png
Binary files differ
diff --git a/v7/mediarouter/res/drawable-mdpi/ic_cast_grey.png b/v7/mediarouter/res/drawable-mdpi/ic_cast_grey.png
new file mode 100644
index 0000000..35ffd60
--- /dev/null
+++ b/v7/mediarouter/res/drawable-mdpi/ic_cast_grey.png
Binary files differ
diff --git a/v7/mediarouter/res/drawable-mdpi/ic_cast_white.png b/v7/mediarouter/res/drawable-mdpi/ic_cast_white.png
new file mode 100644
index 0000000..d62923f
--- /dev/null
+++ b/v7/mediarouter/res/drawable-mdpi/ic_cast_white.png
Binary files differ
diff --git a/v7/mediarouter/res/drawable-xhdpi/ic_cast_grey.png b/v7/mediarouter/res/drawable-xhdpi/ic_cast_grey.png
new file mode 100644
index 0000000..dba8992
--- /dev/null
+++ b/v7/mediarouter/res/drawable-xhdpi/ic_cast_grey.png
Binary files differ
diff --git a/v7/mediarouter/res/drawable-xhdpi/ic_cast_white.png b/v7/mediarouter/res/drawable-xhdpi/ic_cast_white.png
new file mode 100644
index 0000000..f5f7c14
--- /dev/null
+++ b/v7/mediarouter/res/drawable-xhdpi/ic_cast_white.png
Binary files differ
diff --git a/v7/mediarouter/res/drawable-xxhdpi/ic_cast_grey.png b/v7/mediarouter/res/drawable-xxhdpi/ic_cast_grey.png
new file mode 100644
index 0000000..7582751
--- /dev/null
+++ b/v7/mediarouter/res/drawable-xxhdpi/ic_cast_grey.png
Binary files differ
diff --git a/v7/mediarouter/res/drawable-xxhdpi/ic_cast_white.png b/v7/mediarouter/res/drawable-xxhdpi/ic_cast_white.png
new file mode 100644
index 0000000..7a7673fb
--- /dev/null
+++ b/v7/mediarouter/res/drawable-xxhdpi/ic_cast_white.png
Binary files differ
diff --git a/v7/mediarouter/res/drawable-xxxhdpi/ic_cast_grey.png b/v7/mediarouter/res/drawable-xxxhdpi/ic_cast_grey.png
new file mode 100644
index 0000000..d124cb8
--- /dev/null
+++ b/v7/mediarouter/res/drawable-xxxhdpi/ic_cast_grey.png
Binary files differ
diff --git a/v7/mediarouter/res/drawable-xxxhdpi/ic_cast_white.png b/v7/mediarouter/res/drawable-xxxhdpi/ic_cast_white.png
new file mode 100644
index 0000000..bb3539c
--- /dev/null
+++ b/v7/mediarouter/res/drawable-xxxhdpi/ic_cast_white.png
Binary files differ
diff --git a/v7/mediarouter/res/drawable/mr_dialog_material_background_dark.xml b/v7/mediarouter/res/drawable/mr_dialog_material_background_dark.xml
new file mode 100644
index 0000000..54f348c
--- /dev/null
+++ b/v7/mediarouter/res/drawable/mr_dialog_material_background_dark.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<!-- This is the copy of @drawable/abc_dialog_material_background_dark except for inset
+     which includes unnecessary padding. -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+        android:shape="rectangle">
+    <corners android:radius="2dp" />
+    <solid android:color="@color/background_floating_material_dark" />
+</shape>
\ No newline at end of file
diff --git a/v7/mediarouter/res/drawable/mr_dialog_material_background_light.xml b/v7/mediarouter/res/drawable/mr_dialog_material_background_light.xml
new file mode 100644
index 0000000..b5d82af
--- /dev/null
+++ b/v7/mediarouter/res/drawable/mr_dialog_material_background_light.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<!-- This is the copy of @drawable/abc_dialog_material_background_light except for inset
+     which includes unnecessary padding. -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+        android:shape="rectangle">
+    <corners android:radius="2dp" />
+    <solid android:color="@color/background_floating_material_light" />
+</shape>
\ No newline at end of file
diff --git a/v7/mediarouter/res/layout/mr_controller_material_dialog_b.xml b/v7/mediarouter/res/layout/mr_controller_material_dialog_b.xml
index b44c1dc..22686a6 100644
--- a/v7/mediarouter/res/layout/mr_controller_material_dialog_b.xml
+++ b/v7/mediarouter/res/layout/mr_controller_material_dialog_b.xml
@@ -22,7 +22,7 @@
     <LinearLayout android:id="@+id/mr_dialog_area"
                   android:layout_width="fill_parent"
                   android:layout_height="wrap_content"
-                  android:background="?android:attr/windowBackground"
+                  android:background="?attr/MediaRouteControllerWindowBackground"
                   android:layout_gravity="center"
                   android:orientation="vertical">
         <LinearLayout android:id="@+id/mr_title_bar"
diff --git a/v7/mediarouter/res/values/attrs.xml b/v7/mediarouter/res/values/attrs.xml
index cd6e95b..81073dc 100644
--- a/v7/mediarouter/res/values/attrs.xml
+++ b/v7/mediarouter/res/values/attrs.xml
@@ -26,6 +26,7 @@
         <attr name="android:minHeight" />
     </declare-styleable>
 
+    <attr name="MediaRouteControllerWindowBackground" format="reference" />
     <attr name="mediaRouteButtonStyle" format="reference" />
     <attr name="mediaRouteOffDrawable" format="reference" />
     <attr name="mediaRouteConnectingDrawable" format="reference" />
@@ -36,9 +37,10 @@
     <attr name="mediaRouteCastDrawable" format="reference" />
     <attr name="mediaRouteAudioTrackDrawable" format="reference" />
     <attr name="mediaRouteDefaultIconDrawable" format="reference" />
+    <attr name="mediaRouteBluetoothIconDrawable" format="reference" />
+    <attr name="mediaRouteTvIconDrawable" format="reference" />
     <attr name="mediaRouteSpeakerIconDrawable" format="reference" />
     <attr name="mediaRouteSpeakerGroupIconDrawable" format="reference" />
-    <attr name="mediaRouteBluetoothIconDrawable" format="reference" />
     <attr name="mediaRouteChooserPrimaryTextStyle" format="reference" />
     <attr name="mediaRouteChooserSecondaryTextStyle" format="reference" />
     <attr name="mediaRouteControllerTitleTextStyle" format="reference" />
diff --git a/v7/mediarouter/res/values/themes.xml b/v7/mediarouter/res/values/themes.xml
index 3890199..95aac1c 100644
--- a/v7/mediarouter/res/values/themes.xml
+++ b/v7/mediarouter/res/values/themes.xml
@@ -20,6 +20,7 @@
         <item name="android:windowNoTitle">false</item>
         <item name="mediaRouteButtonStyle">@style/Widget.MediaRouter.MediaRouteButton</item>
 
+        <item name="MediaRouteControllerWindowBackground">@drawable/mr_dialog_material_background_dark</item>
         <item name="mediaRouteOffDrawable">@drawable/ic_media_route_off_mono_dark</item>
         <item name="mediaRouteConnectingDrawable">@drawable/mr_ic_media_route_connecting_mono_dark</item>
         <item name="mediaRouteOnDrawable">@drawable/ic_media_route_on_mono_dark</item>
@@ -28,10 +29,11 @@
         <item name="mediaRoutePauseDrawable">@drawable/mr_ic_pause_dark</item>
         <item name="mediaRouteCastDrawable">@drawable/mr_ic_cast_dark</item>
         <item name="mediaRouteAudioTrackDrawable">@drawable/ic_audiotrack</item>
-        <item name="mediaRouteDefaultIconDrawable">@drawable/ic_tv_dark</item>
+        <item name="mediaRouteDefaultIconDrawable">@drawable/ic_cast_white</item>
+        <item name="mediaRouteBluetoothIconDrawable">@drawable/ic_bluetooth_white</item>
+        <item name="mediaRouteTvIconDrawable">@drawable/ic_tv_dark</item>
         <item name="mediaRouteSpeakerIconDrawable">@drawable/ic_speaker_dark</item>
         <item name="mediaRouteSpeakerGroupIconDrawable">@drawable/ic_speaker_group_dark</item>
-        <item name="mediaRouteBluetoothIconDrawable">@drawable/ic_bluetooth_white</item>
         <item name="mediaRouteChooserPrimaryTextStyle">@style/Widget.MediaRouter.ChooserText.Primary.Dark</item>
         <item name="mediaRouteChooserSecondaryTextStyle">@style/Widget.MediaRouter.ChooserText.Secondary.Dark</item>
         <item name="mediaRouteControllerTitleTextStyle">@style/Widget.MediaRouter.ControllerText.Title.Dark</item>
@@ -51,6 +53,7 @@
     <style name="Theme.MediaRouter.Light">
         <item name="mediaRouteButtonStyle">@style/Widget.MediaRouter.Light.MediaRouteButton</item>
 
+        <item name="MediaRouteControllerWindowBackground">@drawable/mr_dialog_material_background_light</item>
         <item name="mediaRouteOffDrawable">@drawable/ic_cast_off_light</item>
         <item name="mediaRouteConnectingDrawable">@drawable/mr_ic_media_route_connecting_mono_light</item>
         <item name="mediaRouteOnDrawable">@drawable/ic_cast_on_light</item>
@@ -59,10 +62,11 @@
         <item name="mediaRoutePauseDrawable">@drawable/mr_ic_pause_light</item>
         <item name="mediaRouteCastDrawable">@drawable/mr_ic_cast_light</item>
         <item name="mediaRouteAudioTrackDrawable">@drawable/mr_ic_audiotrack_light</item>
-        <item name="mediaRouteDefaultIconDrawable">@drawable/ic_tv_light</item>
+        <item name="mediaRouteDefaultIconDrawable">@drawable/ic_cast_grey</item>
+        <item name="mediaRouteBluetoothIconDrawable">@drawable/ic_bluetooth_grey</item>
+        <item name="mediaRouteTvIconDrawable">@drawable/ic_tv_light</item>
         <item name="mediaRouteSpeakerIconDrawable">@drawable/ic_speaker_light</item>
         <item name="mediaRouteSpeakerGroupIconDrawable">@drawable/ic_speaker_group_light</item>
-        <item name="mediaRouteBluetoothIconDrawable">@drawable/ic_bluetooth_grey</item>
         <item name="mediaRouteChooserPrimaryTextStyle">@style/Widget.MediaRouter.ChooserText.Primary.Light</item>
         <item name="mediaRouteChooserSecondaryTextStyle">@style/Widget.MediaRouter.ChooserText.Secondary.Light</item>
         <item name="mediaRouteControllerTitleTextStyle">@style/Widget.MediaRouter.ControllerText.Title.Light</item>
diff --git a/v7/mediarouter/src/android/support/v7/app/MediaRouteChooserDialog.java b/v7/mediarouter/src/android/support/v7/app/MediaRouteChooserDialog.java
index 1ffb19a..9beb8d9 100644
--- a/v7/mediarouter/src/android/support/v7/app/MediaRouteChooserDialog.java
+++ b/v7/mediarouter/src/android/support/v7/app/MediaRouteChooserDialog.java
@@ -214,22 +214,25 @@
             implements ListView.OnItemClickListener {
         private final LayoutInflater mInflater;
         private final Drawable mDefaultIcon;
+        private final Drawable mBluetoothIcon;
+        private final Drawable mTvIcon;
         private final Drawable mSpeakerIcon;
         private final Drawable mSpeakerGroupIcon;
-        private final Drawable mBluetoothIcon;
 
         public RouteAdapter(Context context, List<MediaRouter.RouteInfo> routes) {
             super(context, 0, routes);
             mInflater = LayoutInflater.from(context);
             TypedArray styledAttributes = getContext().obtainStyledAttributes(new int[] {
                     R.attr.mediaRouteDefaultIconDrawable,
+                    R.attr.mediaRouteBluetoothIconDrawable,
+                    R.attr.mediaRouteTvIconDrawable,
                     R.attr.mediaRouteSpeakerIconDrawable,
-                    R.attr.mediaRouteSpeakerGroupIconDrawable,
-                    R.attr.mediaRouteBluetoothIconDrawable });
+                    R.attr.mediaRouteSpeakerGroupIconDrawable});
             mDefaultIcon = styledAttributes.getDrawable(0);
-            mSpeakerIcon = styledAttributes.getDrawable(1);
-            mSpeakerGroupIcon = styledAttributes.getDrawable(2);
-            mBluetoothIcon = styledAttributes.getDrawable(3);
+            mBluetoothIcon = styledAttributes.getDrawable(1);
+            mTvIcon = styledAttributes.getDrawable(2);
+            mSpeakerIcon = styledAttributes.getDrawable(3);
+            mSpeakerGroupIcon = styledAttributes.getDrawable(4);
             styledAttributes.recycle();
         }
 
@@ -305,12 +308,15 @@
 
         private Drawable getDefaultIconDrawable(MediaRouter.RouteInfo route) {
             // If the type of the receiver device is specified, use it.
-            int deviceType = route.getDeviceType();
-            if (deviceType == MediaRouter.RouteInfo.DEVICE_TYPE_SPEAKER) {
-                return mSpeakerIcon;
-            } else if (deviceType == MediaRouter.RouteInfo.DEVICE_TYPE_BLUETOOTH) {
-                return mBluetoothIcon;
+            switch (route.getDeviceType()) {
+                case MediaRouter.RouteInfo.DEVICE_TYPE_BLUETOOTH:
+                    return mBluetoothIcon;
+                case  MediaRouter.RouteInfo.DEVICE_TYPE_TV:
+                    return mTvIcon;
+                case MediaRouter.RouteInfo.DEVICE_TYPE_SPEAKER:
+                    return mSpeakerIcon;
             }
+
             // Otherwise, make the best guess based on other route information.
             if (route instanceof MediaRouter.RouteGroup) {
                 // Only speakers can be grouped for now.
@@ -319,23 +325,6 @@
             if (isSystemLiveAudioOnlyRoute(route)) {
                 return mBluetoothIcon;
             }
-            if (route.supportsControlCategory(MediaControlIntent.CATEGORY_LIVE_AUDIO)
-                    && !route.supportsControlCategory(MediaControlIntent.CATEGORY_LIVE_VIDEO)) {
-                return mSpeakerIcon;
-            }
-            // A workaround to get the speaker icon for known audio devices.
-            // TODO: Remove once the new setDeviceType(int) API is fully launched.
-            String packageName = route.getProvider().getPackageName();
-            if (packageName != null) {
-                if (packageName.startsWith("com.google.android.music")
-                        || packageName.startsWith("com.sonos")) {
-                    return mSpeakerIcon;
-                }
-            }
-            String description = route.getDescription();
-            if (!TextUtils.isEmpty(description) && description.toLowerCase().contains("audio")) {
-                return mSpeakerIcon;
-            }
             return mDefaultIcon;
         }
     }
diff --git a/v7/preference/NOTICES.md b/v7/preference/NOTICES.md
new file mode 100644
index 0000000..4fe92cc
--- /dev/null
+++ b/v7/preference/NOTICES.md
@@ -0,0 +1,11 @@
+# Change Log
+
+## [23.1.0](https://android.googlesource.com/platform/frameworks/support/+/refs/heads/master/v14/preference) (2015-09-28)
+
+**Breakage and deprecation notices:**
+
+- EditTextPreferenceDialogFragmentCompat
+  - onAddEditTextToDialogView has been removed. Any code depending on overriding this method should
+    be moved to onBindDialogView.
+  - The EditText view is now expected to be present in the dialog layout file with the id
+    @android:id/edit, and is no longer created in code.