Reduce max suggestion to show to 2.
- since we now either have 1 or 2 suggestions, putting most layout
configuration in the xml instead of dynamically setting it in code.
- remove the suggestion header
- vertical center align the suggestion title text for 2 cards to make
the card with single line looks better.
- tint all suggestions icons.
Change-Id: I0130f15d530264e164e5afd7c091f165a4a6adc2
Fixes: 70573674
Fixes: 73293989
Fixes: 64986736
Test: visual and make RunSettingsRoboTests
diff --git a/res/layout/suggestion_container.xml b/res/layout/suggestion_container.xml
index 95a00cc..ee7631d 100644
--- a/res/layout/suggestion_container.xml
+++ b/res/layout/suggestion_container.xml
@@ -23,40 +23,11 @@
android:paddingTop="2dp"
android:orientation="vertical">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal"
- android:gravity="center_vertical">
-
- <TextView
- android:id="@android:id/title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="24dp"
- android:layout_centerVertical="true"
- android:gravity="start"
- android:text="@string/suggestions_title_v2"
- android:textAppearance="@style/TextAppearance.SuggestionHeader" />
-
- <TextView
- android:id="@android:id/summary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:layout_marginEnd="24dp"
- android:layout_centerVertical="true"
- android:gravity="end"
- android:textAppearance="@style/TextAppearance.SuggestionHeader" />
-
- </LinearLayout>
-
<android.support.v7.widget.RecyclerView
android:id="@+id/suggestion_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingTop="12dp"
- android:paddingBottom="13dp"
+ android:paddingBottom="16dp"
android:scrollbars="none"/>
</LinearLayout>
diff --git a/res/layout/suggestion_tile.xml b/res/layout/suggestion_tile.xml
index 850e55a..9493e2d 100644
--- a/res/layout/suggestion_tile.xml
+++ b/res/layout/suggestion_tile.xml
@@ -18,8 +18,10 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/suggestion_card"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="16dp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true"
app:cardElevation="2dp"
@@ -27,8 +29,8 @@
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="112dp"
+ android:layout_height="112dp"
+ android:paddingBottom="8dp"
android:orientation="vertical">
<RelativeLayout
@@ -42,7 +44,7 @@
android:layout_height="@dimen/suggestion_card_icon_size"
style="@style/SuggestionCardIcon"
android:layout_marginTop="16dp"
- android:layout_marginBottom="8dp" />
+ android:layout_marginBottom="6dp" />
<ImageView
android:id="@+id/close_button"
@@ -66,7 +68,6 @@
android:layout_marginEnd="12dp"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.SuggestionTitle"
- android:ellipsize="end"
android:fadingEdge="horizontal" />
<TextView
@@ -76,6 +77,7 @@
style="@style/SuggestionCardText"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
+ android:singleLine="true"
android:textAppearance="@style/TextAppearance.SuggestionSummary" />
</LinearLayout>
diff --git a/res/layout/suggestion_tile_two_cards.xml b/res/layout/suggestion_tile_two_cards.xml
new file mode 100644
index 0000000..c06fb7a
--- /dev/null
+++ b/res/layout/suggestion_tile_two_cards.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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.
+-->
+
+<android.support.v7.widget.CardView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/suggestion_card"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:cardPreventCornerOverlap="false"
+ app:cardUseCompatPadding="true"
+ app:cardElevation="2dp"
+ app:cardCornerRadius="@dimen/suggestion_card_corner_radius">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="112dp"
+ android:orientation="vertical">
+
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <ImageView
+ android:id="@android:id/icon"
+ android:layout_width="@dimen/suggestion_card_icon_size"
+ android:layout_height="@dimen/suggestion_card_icon_size"
+ style="@style/SuggestionCardIcon"
+ android:layout_marginTop="16dp"
+ android:layout_marginBottom="8dp" />
+
+ <ImageView
+ android:id="@+id/close_button"
+ android:layout_width="18dp"
+ android:layout_height="18dp"
+ android:alpha="0.54"
+ android:layout_alignParentEnd="true"
+ android:layout_marginTop="8dp"
+ android:layout_marginEnd="8dp"
+ android:contentDescription="@string/dlg_close"
+ android:src="@drawable/ic_suggestion_close_button"/>
+
+ </RelativeLayout>
+
+ <TextView
+ android:id="@android:id/title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ style="@style/SuggestionCardText"
+ android:layout_marginStart="12dp"
+ android:layout_marginEnd="12dp"
+ android:layout_marginBottom="16dp"
+ android:gravity="center_vertical"
+ android:textAppearance="@style/TextAppearance.SuggestionTitle"
+ android:maxLines="3"
+ android:ellipsize="end"
+ android:fadingEdge="horizontal" />
+
+ </LinearLayout>
+
+</android.support.v7.widget.CardView>
diff --git a/res/layout/suggestion_tile_with_button.xml b/res/layout/suggestion_tile_with_button.xml
index 8fb8e84..7b9ddf9 100644
--- a/res/layout/suggestion_tile_with_button.xml
+++ b/res/layout/suggestion_tile_with_button.xml
@@ -18,8 +18,10 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/suggestion_card"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="16dp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true"
app:cardElevation="2dp"
@@ -27,8 +29,7 @@
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="112dp"
+ android:layout_height="160dp"
android:orientation="vertical">
<RelativeLayout
@@ -42,7 +43,7 @@
android:layout_height="@dimen/suggestion_card_icon_size"
style="@style/SuggestionCardIcon"
android:layout_marginTop="16dp"
- android:layout_marginBottom="8dp" />
+ android:layout_marginBottom="6dp" />
<ImageView
android:id="@+id/close_button"
@@ -66,7 +67,6 @@
android:layout_marginEnd="12dp"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.SuggestionTitle"
- android:ellipsize="end"
android:fadingEdge="horizontal" />
<TextView
@@ -76,6 +76,7 @@
style="@style/SuggestionCardText"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
+ android:singleLine="true"
android:textAppearance="@style/TextAppearance.SuggestionSummary" />
<Button
@@ -84,7 +85,7 @@
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="12dp"
+ android:layout_marginTop="16dp"
android:layout_marginBottom="18dp"
android:text="@string/suggestion_button_text" />