MediaRouterV2: 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
- Need to change the image icon once we get the images from UX.
- Adjust the text style.
- Test and apply the new ux for before v7.
Bug: 23117157
Change-Id: I485730b14dfd2fe00bfd6753d27314522582d606
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..708f342 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,21 +16,26 @@
<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_marginRight="24dp"
+ android:src="?attr/mediaRouteOnDrawable"/>
+
<LinearLayout android:layout_width="0dp"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:layout_weight="1"
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:ellipsize="marquee"
android:textAppearance="?android:attr/textAppearanceMedium"
@@ -38,7 +43,7 @@
<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..d130afe 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,14 @@
<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:padding="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/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/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);