MediaRouter: MediaRouteChooserDialog layout

- Change the title to "Cast to".
- Remove the cast icon on the title.
- Add a default image icon for route items.
- Tweak the paddings, margins and sizes of the route item.

TODOs
- Adjust the text style.

Bug: 23117157, Bug: 23116379
Change-Id: I46544ac46df0f98ed062a71d060e831e75d71b71
diff --git a/v7/mediarouter/res/drawable-hdpi/ic_tv_dark.png b/v7/mediarouter/res/drawable-hdpi/ic_tv_dark.png
new file mode 100755
index 0000000..d1335f6
--- /dev/null
+++ b/v7/mediarouter/res/drawable-hdpi/ic_tv_dark.png
Binary files differ
diff --git a/v7/mediarouter/res/drawable-hdpi/ic_tv_light.png b/v7/mediarouter/res/drawable-hdpi/ic_tv_light.png
new file mode 100755
index 0000000..7330f56
--- /dev/null
+++ b/v7/mediarouter/res/drawable-hdpi/ic_tv_light.png
Binary files differ
diff --git a/v7/mediarouter/res/drawable-mdpi/ic_tv_dark.png b/v7/mediarouter/res/drawable-mdpi/ic_tv_dark.png
new file mode 100755
index 0000000..82358a9
--- /dev/null
+++ b/v7/mediarouter/res/drawable-mdpi/ic_tv_dark.png
Binary files differ
diff --git a/v7/mediarouter/res/drawable-mdpi/ic_tv_light.png b/v7/mediarouter/res/drawable-mdpi/ic_tv_light.png
new file mode 100755
index 0000000..ba3f3d5
--- /dev/null
+++ b/v7/mediarouter/res/drawable-mdpi/ic_tv_light.png
Binary files differ
diff --git a/v7/mediarouter/res/drawable-xhdpi/ic_tv_dark.png b/v7/mediarouter/res/drawable-xhdpi/ic_tv_dark.png
new file mode 100755
index 0000000..cef8ac5
--- /dev/null
+++ b/v7/mediarouter/res/drawable-xhdpi/ic_tv_dark.png
Binary files differ
diff --git a/v7/mediarouter/res/drawable-xhdpi/ic_tv_light.png b/v7/mediarouter/res/drawable-xhdpi/ic_tv_light.png
new file mode 100755
index 0000000..3131256
--- /dev/null
+++ b/v7/mediarouter/res/drawable-xhdpi/ic_tv_light.png
Binary files differ
diff --git a/v7/mediarouter/res/drawable-xxhdpi/ic_tv_dark.png b/v7/mediarouter/res/drawable-xxhdpi/ic_tv_dark.png
new file mode 100755
index 0000000..a6a4858
--- /dev/null
+++ b/v7/mediarouter/res/drawable-xxhdpi/ic_tv_dark.png
Binary files differ
diff --git a/v7/mediarouter/res/drawable-xxhdpi/ic_tv_light.png b/v7/mediarouter/res/drawable-xxhdpi/ic_tv_light.png
new file mode 100755
index 0000000..4ca6787
--- /dev/null
+++ b/v7/mediarouter/res/drawable-xxhdpi/ic_tv_light.png
Binary files differ
diff --git a/v7/mediarouter/res/layout-v17/mr_media_route_list_item.xml b/v7/mediarouter/res/layout-v17/mr_media_route_list_item.xml
index 1b798ee..7832abf 100644
--- a/v7/mediarouter/res/layout-v17/mr_media_route_list_item.xml
+++ b/v7/mediarouter/res/layout-v17/mr_media_route_list_item.xml
@@ -16,29 +16,37 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
               android:layout_width="match_parent"
-              android:layout_height="?android:attr/listPreferredItemHeight"
+              android:layout_height="wrap_content"
+              android:orientation="horizontal"
               android:gravity="center_vertical">
 
+    <ImageView android:id="@+id/routeIcon"
+               android:layout_width="24dp"
+               android:layout_height="24dp"
+               android:layout_marginLeft="24dp"
+               android:layout_marginRight="24dp"
+               android:src="?attr/mediaRouteDefaultIconDrawable" />
+
     <LinearLayout android:layout_width="0dp"
-                  android:layout_height="match_parent"
+                  android:layout_height="wrap_content"
                   android:layout_weight="1"
+                  android:layout_marginRight="24dp"
                   android:orientation="vertical"
                   android:gravity="start|center_vertical"
-                  android:paddingStart="?android:attr/listPreferredItemPaddingStart"
-                  android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
                   android:duplicateParentState="true">
 
         <TextView android:id="@android:id/text1"
                   android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
+                  android:layout_height="32dp"
                   android:singleLine="true"
+                  android:gravity="bottom"
                   android:ellipsize="marquee"
                   android:textAppearance="?android:attr/textAppearanceMedium"
                   android:duplicateParentState="true" />
 
         <TextView android:id="@android:id/text2"
                   android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
+                  android:layout_height="24dp"
                   android:singleLine="true"
                   android:ellipsize="marquee"
                   android:textAppearance="?android:attr/textAppearanceSmall"
diff --git a/v7/mediarouter/res/layout/mr_media_route_chooser_dialog.xml b/v7/mediarouter/res/layout/mr_media_route_chooser_dialog.xml
index afdad71..393d4fb 100644
--- a/v7/mediarouter/res/layout/mr_media_route_chooser_dialog.xml
+++ b/v7/mediarouter/res/layout/mr_media_route_chooser_dialog.xml
@@ -17,10 +17,15 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
-              android:orientation="vertical">
+              android:orientation="vertical"
+              android:paddingTop="24dp"
+              android:paddingBottom="24dp">
+
     <ListView android:id="@+id/media_route_list"
               android:layout_width="fill_parent"
-              android:layout_height="wrap_content" />
+              android:layout_height="wrap_content"
+              android:divider="@android:color/transparent"
+              android:dividerHeight="@dimen/mr_list_item_margin"/>
 
     <LinearLayout android:id="@android:id/empty"
               android:layout_width="fill_parent"
diff --git a/v7/mediarouter/res/values-v17/dimens.xml b/v7/mediarouter/res/values-v17/dimens.xml
new file mode 100644
index 0000000..41b5479
--- /dev/null
+++ b/v7/mediarouter/res/values-v17/dimens.xml
@@ -0,0 +1,19 @@
+<?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.
+-->
+
+<resources>
+    <dimen name="mr_list_item_margin">24dp</dimen>
+</resources>
\ No newline at end of file
diff --git a/v7/mediarouter/res/values/attrs.xml b/v7/mediarouter/res/values/attrs.xml
index 9f5f8ac..67727a8 100644
--- a/v7/mediarouter/res/values/attrs.xml
+++ b/v7/mediarouter/res/values/attrs.xml
@@ -34,4 +34,5 @@
     <attr name="mediaRoutePlayDrawable" format="reference" />
     <attr name="mediaRoutePauseDrawable" format="reference" />
     <attr name="mediaRouteCastDrawable" format="reference" />
+    <attr name="mediaRouteDefaultIconDrawable" format="reference" />
 </resources>
\ No newline at end of file
diff --git a/v7/mediarouter/res/values/dimens.xml b/v7/mediarouter/res/values/dimens.xml
index e687c82..b6c3058 100644
--- a/v7/mediarouter/res/values/dimens.xml
+++ b/v7/mediarouter/res/values/dimens.xml
@@ -16,4 +16,5 @@
 
 <resources>
     <dimen name="mr_media_route_controller_art_max_height">320dp</dimen>
+    <dimen name="mr_list_item_margin">0dp</dimen>
 </resources>
\ No newline at end of file
diff --git a/v7/mediarouter/res/values/strings.xml b/v7/mediarouter/res/values/strings.xml
index a87ce4f..70df280 100644
--- a/v7/mediarouter/res/values/strings.xml
+++ b/v7/mediarouter/res/values/strings.xml
@@ -26,7 +26,7 @@
     <string name="mr_media_route_button_content_description">Cast</string>
 
     <!-- Title of the media route chooser dialog. [CHAR LIMIT=30] -->
-    <string name="mr_media_route_chooser_title">Connect to device</string>
+    <string name="mr_media_route_chooser_title">Cast to</string>
 
     <!-- Placeholder text to show when no devices have been found. [CHAR LIMIT=50] -->
     <string name="mr_media_route_chooser_searching">Searching for devices\u2026</string>
diff --git a/v7/mediarouter/res/values/themes.xml b/v7/mediarouter/res/values/themes.xml
index 99bca59..8a91265 100644
--- a/v7/mediarouter/res/values/themes.xml
+++ b/v7/mediarouter/res/values/themes.xml
@@ -27,6 +27,7 @@
         <item name="mediaRoutePlayDrawable">@drawable/mr_ic_play_dark</item>
         <item name="mediaRoutePauseDrawable">@drawable/mr_ic_pause_dark</item>
         <item name="mediaRouteCastDrawable">@drawable/mr_ic_cast_dark</item>
+        <item name="mediaRouteDefaultIconDrawable">@drawable/ic_tv_dark</item>
     </style>
 
     <style name="Theme.MediaRouter.Light" parent="">
@@ -40,6 +41,7 @@
         <item name="mediaRoutePlayDrawable">@drawable/mr_ic_play_light</item>
         <item name="mediaRoutePauseDrawable">@drawable/mr_ic_pause_light</item>
         <item name="mediaRouteCastDrawable">@drawable/mr_ic_cast_light</item>
+        <item name="mediaRouteDefaultIconDrawable">@drawable/ic_tv_light</item>
     </style>
 
 </resources>
diff --git a/v7/mediarouter/src/android/support/v7/app/MediaRouteChooserDialog.java b/v7/mediarouter/src/android/support/v7/app/MediaRouteChooserDialog.java
index 9dea547..7746745 100644
--- a/v7/mediarouter/src/android/support/v7/app/MediaRouteChooserDialog.java
+++ b/v7/mediarouter/src/android/support/v7/app/MediaRouteChooserDialog.java
@@ -18,6 +18,8 @@
 
 import android.app.Dialog;
 import android.content.Context;
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
 import android.os.Bundle;
 import android.support.annotation.NonNull;
 import android.support.v7.media.MediaControlIntent;
@@ -139,16 +141,9 @@
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        getWindow().requestFeature(Window.FEATURE_LEFT_ICON);
-
         setContentView(R.layout.mr_media_route_chooser_dialog);
         setTitle(R.string.mr_media_route_chooser_title);
 
-        // Must be called after setContentView.
-        getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,
-                MediaRouterThemeHelper.getThemeResource(
-                        getContext(), R.attr.mediaRouteOffDrawable));
-
         mRoutes = new ArrayList<MediaRouter.RouteInfo>();
         mAdapter = new RouteAdapter(getContext(), mRoutes);
         mListView = (ListView)findViewById(R.id.media_route_list);