Fix subheader text appearance and height.
Bug: 138853604
Fixes: 138853604
Test: manually
Change-Id: Idfa946d15487221c18a941220245f246542aa0df
diff --git a/res/layout/contact_list_item.xml b/res/layout/contact_list_item.xml
index 2dafe57..6ed6e1c 100644
--- a/res/layout/contact_list_item.xml
+++ b/res/layout/contact_list_item.xml
@@ -20,12 +20,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
- <TextView
+ <include
+ layout="@layout/header_item"
android:id="@+id/header"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:singleLine="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/user_profile_container"
app:layout_constraintStart_toStartOf="parent"/>
diff --git a/res/layout/header_item.xml b/res/layout/header_item.xml
index e7343f8..5a7a374 100644
--- a/res/layout/header_item.xml
+++ b/res/layout/header_item.xml
@@ -13,8 +13,12 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
+
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/title"
android:layout_width="match_parent"
- android:layout_height="wrap_content"/>
+ android:layout_height="@dimen/subheader_list_height"
+ android:singleLine="true"
+ android:gravity="center_vertical"
+ style="@style/SubheaderText"/>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 93068b0..a6ae486 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -142,6 +142,7 @@
<dimen name="hero_button_corner_radius">38dp</dimen>
<dimen name="contact_avatar_corner_radius_percent" format="float">0.5</dimen>
<dimen name="touch_target_width">156dp</dimen>
+ <dimen name="subheader_list_height">76dp</dimen>
<dimen name="phone_number_radio_list_padding">@*android:dimen/car_padding_2</dimen>
<dimen name="phone_number_favorite_list_item_vertical_padding">@*android:dimen/car_padding_2</dimen>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index fcbdcdb..5b2ecde 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -136,6 +136,13 @@
<!-- Contact results -->
<style name="TextAppearance.ContactResultTitle" parent="@style/TextAppearance.Body1"/>
+ <!-- Subheader -->
+ <style name="SubheaderText">
+ <item name="android:textAppearance">@style/TextAppearance.Body3</item>
+ <item name="android:textFontWeight">500</item>
+ <item name="android:textStyle">normal</item>
+ </style>
+
<!-- Display options defined for ActionBar-->
<style name="RootToolbarDisplayOptions">
<item name="android:displayOptions">useLogo|showHome|showTitle|showCustom</item>
diff --git a/tests/robotests/res/values-h610dp/styles.xml b/tests/robotests/res/values-h610dp/styles.xml
new file mode 100644
index 0000000..5a4eaa1
--- /dev/null
+++ b/tests/robotests/res/values-h610dp/styles.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2019 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>
+ <!-- Subheader override to make test pass. Need to use qualifier to h610dp to make it work -->
+ <style name="SubheaderText">
+ <item name="android:textAppearance">@style/TextAppearance.Body3</item>
+ </style>
+</resources>
diff --git a/tests/robotests/src/com/android/car/dialer/ui/calllog/CallHistoryFragmentTest.java b/tests/robotests/src/com/android/car/dialer/ui/calllog/CallHistoryFragmentTest.java
index 73553cd..d249e4b 100644
--- a/tests/robotests/src/com/android/car/dialer/ui/calllog/CallHistoryFragmentTest.java
+++ b/tests/robotests/src/com/android/car/dialer/ui/calllog/CallHistoryFragmentTest.java
@@ -55,7 +55,7 @@
import java.util.Arrays;
import java.util.List;
-@Config(shadows = {ShadowAndroidViewModelFactory.class})
+@Config(shadows = {ShadowAndroidViewModelFactory.class}, qualifiers = "h610dp")
@RunWith(CarDialerRobolectricTestRunner.class)
public class CallHistoryFragmentTest {
private static final String HEADER = "TODAY";
diff --git a/tests/robotests/src/com/android/car/dialer/ui/contact/ContactListFragmentTest.java b/tests/robotests/src/com/android/car/dialer/ui/contact/ContactListFragmentTest.java
index 327a69a..d8c87c1 100644
--- a/tests/robotests/src/com/android/car/dialer/ui/contact/ContactListFragmentTest.java
+++ b/tests/robotests/src/com/android/car/dialer/ui/contact/ContactListFragmentTest.java
@@ -54,7 +54,7 @@
import java.util.Arrays;
import java.util.List;
-@Config(shadows = {ShadowAndroidViewModelFactory.class})
+@Config(shadows = {ShadowAndroidViewModelFactory.class}, qualifiers = "h610dp")
@RunWith(CarDialerRobolectricTestRunner.class)
public class ContactListFragmentTest {
private static final String RAW_NUMBNER = "6502530000";
diff --git a/tests/robotests/src/com/android/car/dialer/ui/contact/ContactListViewHolderTest.java b/tests/robotests/src/com/android/car/dialer/ui/contact/ContactListViewHolderTest.java
index 97e79f2..5ec96e0 100644
--- a/tests/robotests/src/com/android/car/dialer/ui/contact/ContactListViewHolderTest.java
+++ b/tests/robotests/src/com/android/car/dialer/ui/contact/ContactListViewHolderTest.java
@@ -43,10 +43,12 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowAlertDialog;
import java.util.Arrays;
+@Config(qualifiers = "h610dp")
@RunWith(CarDialerRobolectricTestRunner.class)
public class ContactListViewHolderTest {
private static final String DISPLAY_NAME = "Display Name";