UX polish updates

Padding, color, and dynamic text resizing. See full details in
b/183084168.

Bug: 185131475, 183084168, 1804014433
Test: PeopleTileViewHelperTest
Change-Id: Ie6a4da771b9735ccce7b0549acfea4c17231d915
This commit is contained in:
Anna Zappone
2021-05-11 21:58:49 +01:00
parent cc4fa5f3b6
commit 514ce64531
16 changed files with 378 additions and 241 deletions

View File

@@ -588,13 +588,15 @@
android:label="@string/people_tile_title"
android:enabled="true"
android:exported="true"
android:windowDisablePreview="true"
android:theme="@style/Theme.PeopleTileConfigActivity">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
</intent-filter>
</activity>
<activity android:name=".people.widget.LaunchConversationActivity" />
<activity android:name=".people.widget.LaunchConversationActivity"
android:windowDisablePreview="true" />
<!-- People Space Widget -->
<receiver

View File

@@ -15,8 +15,10 @@
~ limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size android:height="10dp"
android:width="10dp" />
<solid android:color="#34A853" />
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:shape="oval">
<size
android:height="10dp"
android:width="10dp" />
<solid android:color="?androidprv:attr/colorAccentPrimaryVariant" />
</shape>

View File

@@ -14,7 +14,8 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#9ED582" />
<shape xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
<solid android:color="?androidprv:attr/colorAccentPrimary" />
<corners android:radius="@dimen/people_space_messages_count_radius" />
</shape>

View File

@@ -14,30 +14,28 @@
~ limitations under the License.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item"
android:background="@drawable/people_space_tile_view_card"
android:theme="@android:style/Theme.DeviceDefault.DayNight"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:paddingHorizontal="16dp"
android:paddingTop="14dp"
android:paddingBottom="16dp">
<LinearLayout
android:id="@+id/item"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:background="@drawable/people_space_tile_view_card"
android:orientation="vertical"
android:paddingHorizontal="16dp"
android:paddingVertical="16dp">
android:layout_height="wrap_content"
android:gravity="top|center_horizontal"
android:orientation="vertical">
<ImageView
android:id="@+id/person_icon"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/name"
android:layout_gravity="center"
android:paddingTop="14dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -45,24 +43,22 @@
android:singleLine="true"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textColor="?android:attr/textColorPrimary"
android:textSize="16sp" />
android:textSize="@dimen/name_text_size_for_large" />
<TextView
android:id="@+id/last_interaction"
android:layout_gravity="center"
android:text="@string/empty_status"
android:textColor="?android:attr/textColorSecondary"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textSize="14sp"
android:textSize="@dimen/content_text_size_for_large"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"/>
<ImageView
android:id="@+id/availability"
android:layout_gravity="center"
android:layout_width="10dp"
android:layout_height="26dp"
android:paddingTop="16dp"
android:background="@drawable/circle_green_10dp"/>
</LinearLayout>
<ImageView
android:id="@+id/availability"
android:layout_gravity="bottom|center_horizontal"
android:layout_width="10dp"
android:layout_height="10dp"
android:background="@drawable/availability_dot_10dp"/>
</FrameLayout>

View File

@@ -13,147 +13,136 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/people_space_tile_view_card"
android:id="@+id/item"
android:clipToOutline="true"
android:theme="@android:style/Theme.DeviceDefault.DayNight"
android:layout_gravity="center"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:layout_gravity="center"
android:padding="16dp"
android:orientation="vertical">
<include layout="@layout/people_status_scrim_layout" />
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:padding="16dp"
android:orientation="vertical">
android:layout_height="wrap_content"
android:gravity="start|top">
<RelativeLayout
android:layout_width="match_parent"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="start|top">
android:layout_alignParentStart="true"
android:gravity="start|top"
android:orientation="horizontal">
<LinearLayout
<ImageView
android:id="@+id/person_icon"
android:layout_marginStart="-2dp"
android:layout_marginTop="-2dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:gravity="start|top"
android:layout_weight="1" />
<ImageView
android:id="@+id/availability"
android:layout_marginStart="-2dp"
android:layout_width="10dp"
android:layout_height="10dp"
android:background="@drawable/availability_dot_10dp" />
</LinearLayout>
<TextView
android:id="@+id/messages_count"
android:layout_alignParentEnd="true"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textColor="?android:attr/textColorPrimary"
android:background="@drawable/people_space_messages_count_background"
android:textSize="14sp"
android:maxLines="1"
android:ellipsize="end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/people_tile_punctuation_background_large" />
<include layout="@layout/people_tile_emoji_background_large" />
<TextView
android:layout_gravity="top"
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/below_name_text_padding"
android:gravity="start|top"
android:singleLine="true"
android:ellipsize="end"
android:text="@string/empty_user_name"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/name_text_size_for_content" />
<LinearLayout
android:id="@+id/content"
android:layout_below="@id/name"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/status_icon_and_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/person_icon"
android:layout_marginStart="-2dp"
android:layout_marginTop="-2dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<ImageView
android:id="@+id/availability"
android:layout_marginStart="-2dp"
android:layout_width="10dp"
android:layout_height="10dp"
android:background="@drawable/circle_green_10dp" />
</LinearLayout>
<TextView
android:id="@+id/messages_count"
android:layout_alignParentEnd="true"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textColor="?android:attr/textColorPrimary"
android:background="@drawable/people_space_messages_count_background"
android:textSize="14sp"
android:maxLines="1"
android:ellipsize="end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/people_tile_punctuation_background_large" />
<include layout="@layout/people_tile_emoji_background_large" />
<LinearLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:id="@+id/predefined_icon"
android:tint="?android:attr/colorAccent"
android:gravity="start|center_vertical"
android:layout_width="@dimen/regular_predefined_icon"
android:layout_height="@dimen/regular_predefined_icon" />
<TextView
android:layout_gravity="center"
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="12dp"
android:gravity="start"
android:singleLine="true"
android:ellipsize="end"
android:text="@string/empty_user_name"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textColor="?android:attr/textColorPrimary"
android:textSize="14sp" />
<LinearLayout
android:id="@+id/status_icon_and_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/subtext"
android:paddingBottom="4dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/predefined_icon"
android:tint="?android:attr/colorAccent"
android:gravity="start|center_vertical"
android:paddingEnd="6dp"
android:layout_width="24dp"
android:layout_height="18dp" />
<TextView
android:layout_gravity="center"
android:id="@+id/subtext"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/empty_user_name"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp" />
</LinearLayout>
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/people_space_content_background"
android:gravity="center"
android:scaleType="centerCrop" />
<TextView
android:layout_gravity="center"
android:id="@+id/text_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:singleLine="false"
android:text="@string/empty_status"
android:singleLine="true"
android:text="@string/empty_user_name"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/content_text_size_for_large" />
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/people_space_content_background"
android:gravity="center"
android:scaleType="centerCrop" />
<TextView
android:layout_gravity="center"
android:id="@+id/text_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:singleLine="false"
android:text="@string/empty_status"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/content_text_size_for_large" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (C) 2021 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.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/people_space_tile_view_card"
android:id="@+id/item"
android:clipToOutline="true"
android:theme="@android:style/Theme.DeviceDefault.DayNight"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/people_tile_large_with_content" />
</RelativeLayout>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (C) 2021 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.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/people_space_tile_view_card"
android:id="@+id/item"
android:clipToOutline="true"
android:theme="@android:style/Theme.DeviceDefault.DayNight"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/people_status_scrim_layout" />
<include layout="@layout/people_tile_large_with_content" />
</RelativeLayout>

View File

@@ -35,13 +35,14 @@
android:layout_height="64dp" />
<ImageView
android:id="@+id/availability"
android:gravity="top"
android:layout_marginStart="-2dp"
android:layout_width="10dp"
android:layout_height="10dp"
android:background="@drawable/circle_green_10dp" />
android:background="@drawable/availability_dot_10dp" />
<LinearLayout
android:orientation="vertical"
android:paddingStart="6dp"
android:paddingStart="4dp"
android:gravity="top"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@@ -50,7 +51,7 @@
android:text="@string/empty_user_name"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textColor="?android:attr/textColorPrimary"
android:textSize="14sp"
android:textSize="@dimen/empty_name_text_size_for_medium"
android:maxLines="1"
android:ellipsize="end"
android:layout_width="wrap_content"
@@ -60,7 +61,7 @@
android:text="@string/empty_status"
android:textColor="?android:attr/textColorSecondary"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textSize="12sp"
android:textSize="@dimen/content_text_size_for_medium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="3"

View File

@@ -57,12 +57,14 @@
android:layout_marginStart="-2dp"
android:layout_width="10dp"
android:layout_height="10dp"
android:background="@drawable/circle_green_10dp" />
android:background="@drawable/availability_dot_10dp" />
<LinearLayout
android:id="@+id/medium_content"
android:orientation="vertical"
android:gravity="top|start"
android:paddingStart="12dp"
android:paddingBottom="@dimen/medium_content_padding_above_name"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@@ -72,7 +74,7 @@
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp"
android:paddingBottom="4dp"
android:paddingBottom="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
@@ -104,9 +106,9 @@
android:gravity="bottom"
android:layout_gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="18dp"
android:clipToOutline="true">
<TextView
android:id="@+id/name"
@@ -115,9 +117,10 @@
android:text="@string/empty_user_name"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textColor="?android:attr/textColorPrimary"
android:textSize="14sp"
android:textSize="@dimen/name_text_size_for_content"
android:singleLine="true"
android:ellipsize="end"
android:paddingEnd="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
@@ -139,9 +142,8 @@
android:id="@+id/predefined_icon"
android:tint="?android:attr/colorAccent"
android:gravity="end|center_vertical"
android:paddingStart="6dp"
android:layout_width="24dp"
android:layout_height="18dp" />
android:layout_width="@dimen/regular_predefined_icon"
android:layout_height="@dimen/regular_predefined_icon" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View File

@@ -48,12 +48,11 @@
android:id="@+id/messages_count"
android:layout_gravity="center"
android:gravity="center"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:paddingHorizontal="8dp"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textColor="?android:attr/textColorPrimary"
android:background="@drawable/people_space_messages_count_background"
android:textSize="14sp"
android:textSize="@dimen/name_text_size_for_small"
android:maxLines="1"
android:ellipsize="end"
android:layout_width="wrap_content"
@@ -71,6 +70,6 @@
android:paddingHorizontal="4dp"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textColor="?android:attr/textColorPrimary"
android:textSize="14sp" />
android:textSize="@dimen/name_text_size_for_small" />
</LinearLayout>
</FrameLayout>

View File

@@ -1413,19 +1413,29 @@
<dimen name="people_space_image_radius">20dp</dimen>
<dimen name="people_space_messages_count_radius">12dp</dimen>
<dimen name="people_space_widget_background_padding">6dp</dimen>
<dimen name="required_width_for_medium">146dp</dimen>
<dimen name="required_width_for_medium">136dp</dimen>
<dimen name="required_width_for_large">138dp</dimen>
<dimen name="required_height_for_large">182dp</dimen>
<dimen name="required_height_for_large">168dp</dimen>
<dimen name="default_width">146dp</dimen>
<dimen name="default_height">92dp</dimen>
<dimen name="avatar_size_for_medium">52dp</dimen>
<dimen name="max_people_avatar_size_for_large_content">64dp</dimen>
<dimen name="max_people_avatar_size">108dp</dimen>
<dimen name="name_text_size_for_small">14sp</dimen>
<dimen name="name_text_size_for_medium">14sp</dimen>
<dimen name="name_text_size_for_large">24sp</dimen>
<dimen name="name_text_size_for_content">12sp</dimen>
<dimen name="empty_name_text_size_for_medium">12sp</dimen>
<dimen name="max_name_text_size_for_medium">14sp</dimen>
<dimen name="medium_height_for_max_name_text_size">104dp</dimen>
<dimen name="name_text_size_for_large">16sp</dimen>
<dimen name="content_text_size_for_medium">12sp</dimen>
<dimen name="content_text_size_for_large">14sp</dimen>
<dimen name="below_name_text_padding">16dp</dimen>
<dimen name="above_notification_text_padding">22dp</dimen>
<dimen name="regular_predefined_icon">18dp</dimen>
<dimen name="large_predefined_icon">24dp</dimen>
<dimen name="availability_dot_status_padding">8dp</dimen>
<dimen name="availability_dot_notification_padding">12dp</dimen>
<dimen name="medium_content_padding_above_name">4dp</dimen>
<!-- Accessibility floating menu -->
<dimen name="accessibility_floating_menu_elevation">5dp</dimen>

View File

@@ -2894,12 +2894,16 @@
<string name="recent_conversations">Recent conversations</string>
<!-- Text for button dismissing configuration activity with no conversations [CHAR LIMIT=20] -->
<string name="okay">Okay</string>
<!-- Timestamp for notification with exact time [CHAR LIMIT=25] -->
<string name="timestamp"><xliff:g id="duration" example="5 hours">%1$s</xliff:g> ago</string>
<!-- Timestamp for notification when less than a certain time window [CHAR LIMIT=25] -->
<string name="less_than_timestamp">Less than <xliff:g id="duration" example="5 hours">%1$s</xliff:g> ago</string>
<!-- Timestamp for notification when over a certain time window [CHAR LIMIT=25] -->
<string name="over_timestamp">Over <xliff:g id="duration" example="1 week">%1$s</xliff:g> ago</string>
<!-- Timestamp for notification with exact time in days plural [CHAR LIMIT=25] -->
<string name="days_timestamp"><xliff:g id="duration" example="5">%1$s</xliff:g> days ago</string>
<!-- Timestamp for notification from one week ago[CHAR LIMIT=25] -->
<string name="one_week_timestamp">1 week ago</string>
<!-- Timestamp for notification from two weeks ago [CHAR LIMIT=25] -->
<string name="two_weeks_timestamp">2 weeks ago</string>
<!-- Timestamp for notification when over one week ago [CHAR LIMIT=25] -->
<string name="over_one_week_timestamp">Over 1 week ago</string>
<!-- Timestamp for notification when over two weeks ago [CHAR LIMIT=25] -->
<string name="over_two_weeks_timestamp">Over 2 weeks ago</string>
<!-- Status text on the Conversation widget for a birthday today [CHAR LIMIT=20] -->
<string name="birthday_status">Birthday</string>
<!-- Content description text on the Conversation widget for a birthday today [CHAR LIMIT=150] -->

View File

@@ -28,7 +28,6 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.IconDrawableFactory;
import android.util.Log;
import android.util.TypedValue;
import com.android.settingslib.Utils;
import com.android.systemui.R;
@@ -37,7 +36,7 @@ class PeopleStoryIconFactory implements AutoCloseable {
private static final int PADDING = 2;
private static final int RING_WIDTH = 2;
private static final int MAX_BADGE_SIZE = 36;
private static final int MAX_BADGE_SIZE = 40;
final PackageManager mPackageManager;
final IconDrawableFactory mIconDrawableFactory;
@@ -51,15 +50,15 @@ class PeopleStoryIconFactory implements AutoCloseable {
PeopleStoryIconFactory(Context context, PackageManager pm,
IconDrawableFactory iconDrawableFactory, int iconSizeDp) {
context.setTheme(android.R.style.Theme_DeviceDefault_DayNight);
mIconBitmapSize = (int) (iconSizeDp * context.getResources().getDisplayMetrics().density);
mDensity = context.getResources().getDisplayMetrics().density;
mIconSize = mDensity * iconSizeDp;
mPackageManager = pm;
mIconDrawableFactory = iconDrawableFactory;
mImportantConversationColor = context.getColor(R.color.important_conversation);
TypedValue typedValue = new TypedValue();
context.getTheme().resolveAttribute(android.R.attr.colorAccent, typedValue, true);
mAccentColor = context.getColor(typedValue.resourceId);
mAccentColor = Utils.getColorAttr(context,
com.android.internal.R.attr.colorAccentPrimary).getDefaultColor();
mContext = context;
}

View File

@@ -55,6 +55,7 @@ import android.text.TextUtils;
import android.util.IconDrawableFactory;
import android.util.Log;
import android.util.Pair;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.widget.RemoteViews;
@@ -87,7 +88,6 @@ public class PeopleTileViewHelper {
private static final int DAYS_IN_A_WEEK = 7;
private static final int ONE_DAY = 1;
private static final int MAX_WEEKS = 2;
public static final int LAYOUT_SMALL = 0;
public static final int LAYOUT_MEDIUM = 1;
@@ -95,10 +95,11 @@ public class PeopleTileViewHelper {
private static final int MIN_CONTENT_MAX_LINES = 2;
private static final int FIXED_HEIGHT_DIMENS_FOR_LARGE_CONTENT = 14 + 12 + 4 + 16;
private static final int FIXED_HEIGHT_DIMENS_FOR_LARGE_NOTIF_CONTENT = 16 + 22 + 8 + 16;
private static final int FIXED_HEIGHT_DIMENS_FOR_LARGE_STATUS_CONTENT = 16 + 16 + 24 + 4 + 16;
private static final int MIN_MEDIUM_VERTICAL_PADDING = 4;
private static final int MAX_MEDIUM_PADDING = 16;
private static final int FIXED_HEIGHT_DIMENS_FOR_MEDIUM_CONTENT_BEFORE_PADDING = 4 + 4;
private static final int FIXED_HEIGHT_DIMENS_FOR_MEDIUM_CONTENT_BEFORE_PADDING = 8 + 4;
private static final int FIXED_HEIGHT_DIMENS_FOR_SMALL = 6 + 4 + 8;
private static final int FIXED_WIDTH_DIMENS_FOR_SMALL = 4 + 4;
@@ -276,12 +277,15 @@ public class PeopleTileViewHelper {
}
private void setMaxLines(RemoteViews views, boolean showSender) {
int textSize = mLayoutSize == LAYOUT_LARGE ? getSizeInDp(
R.dimen.content_text_size_for_large)
: getSizeInDp(R.dimen.content_text_size_for_medium);
int lineHeight = getLineHeight(textSize);
int notificationContentHeight = getContentHeightForLayout(lineHeight);
int maxAdaptiveLines = Math.floorDiv(notificationContentHeight, lineHeight);
int nameHeight = getLineHeightFromResource(R.dimen.name_text_size_for_content);
boolean isStatusLayout =
views.getLayoutId() == R.layout.people_tile_large_with_status_content;
int contentHeight = getContentHeightForLayout(nameHeight, isStatusLayout);
int textSizeResId = mLayoutSize == LAYOUT_LARGE
? R.dimen.content_text_size_for_large
: R.dimen.content_text_size_for_medium;
int lineHeight = getLineHeightFromResource(textSizeResId);
int maxAdaptiveLines = Math.floorDiv(contentHeight, lineHeight);
int maxLines = Math.max(MIN_CONTENT_MAX_LINES, maxAdaptiveLines);
// Save a line for sender's name, if present.
@@ -289,10 +293,12 @@ public class PeopleTileViewHelper {
views.setInt(R.id.text_content, "setMaxLines", maxLines);
}
private int getLineHeight(int textSize) {
private int getLineHeightFromResource(int resId) {
try {
TextView text = new TextView(mContext);
text.setTextSize(textSize);
text.setTextSize(TypedValue.COMPLEX_UNIT_PX,
mContext.getResources().getDimension(resId));
text.setTextAppearance(android.R.style.TextAppearance_DeviceDefault);
int lineHeight = (int) (text.getLineHeight() / mDensity);
return lineHeight;
} catch (Exception e) {
@@ -310,15 +316,17 @@ public class PeopleTileViewHelper {
return (int) (context.getResources().getDimension(dimenResourceId) / density);
}
private int getContentHeightForLayout(int lineHeight) {
private int getContentHeightForLayout(int lineHeight, boolean hasPredefinedIcon) {
switch (mLayoutSize) {
case LAYOUT_MEDIUM:
return mHeight - (lineHeight + FIXED_HEIGHT_DIMENS_FOR_MEDIUM_CONTENT_BEFORE_PADDING
+ mMediumVerticalPadding * 2);
case LAYOUT_LARGE:
int fixedHeight = hasPredefinedIcon ? FIXED_HEIGHT_DIMENS_FOR_LARGE_STATUS_CONTENT
: FIXED_HEIGHT_DIMENS_FOR_LARGE_NOTIF_CONTENT;
return mHeight - (getSizeInDp(
R.dimen.max_people_avatar_size_for_large_content) + lineHeight
+ FIXED_HEIGHT_DIMENS_FOR_LARGE_CONTENT);
+ fixedHeight);
default:
return -1;
}
@@ -326,7 +334,7 @@ public class PeopleTileViewHelper {
/** Calculates the best layout relative to the size in {@code options}. */
private int getLayoutSize() {
if (mHeight >= getSizeInDp(R.dimen.required_width_for_large)
if (mHeight >= getSizeInDp(R.dimen.required_height_for_large)
&& mWidth >= getSizeInDp(R.dimen.required_width_for_large)) {
if (DEBUG) Log.d(TAG, "Large view for mWidth: " + mWidth + " mHeight: " + mHeight);
return LAYOUT_LARGE;
@@ -334,8 +342,9 @@ public class PeopleTileViewHelper {
// Small layout used below a certain minimum mWidth with any mHeight.
if (mWidth >= getSizeInDp(R.dimen.required_width_for_medium)) {
int spaceAvailableForPadding =
mHeight - (getSizeInDp(R.dimen.avatar_size_for_medium) + 4 + getLineHeight(
getSizeInDp(R.dimen.name_text_size_for_medium)));
mHeight - (getSizeInDp(R.dimen.avatar_size_for_medium)
+ getLineHeightFromResource(
R.dimen.name_text_size_for_content));
if (DEBUG) {
Log.d(TAG, "Medium view for mWidth: " + mWidth + " mHeight: " + mHeight
+ " with padding space: " + spaceAvailableForPadding);
@@ -365,26 +374,32 @@ public class PeopleTileViewHelper {
// Calculate adaptive avatar size for remaining layouts.
if (layoutId == R.layout.people_tile_small) {
int avatarHeightSpace = mHeight - (FIXED_HEIGHT_DIMENS_FOR_SMALL + Math.max(18,
getLineHeight(getSizeInDp(
R.dimen.name_text_size_for_small))));
getLineHeightFromResource(
R.dimen.name_text_size_for_small)));
int avatarWidthSpace = mWidth - FIXED_WIDTH_DIMENS_FOR_SMALL;
avatarSize = Math.min(avatarHeightSpace, avatarWidthSpace);
}
if (layoutId == R.layout.people_tile_large_with_content) {
avatarSize = mHeight - (FIXED_HEIGHT_DIMENS_FOR_LARGE_CONTENT + (getLineHeight(
getSizeInDp(R.dimen.content_text_size_for_large))
* 3));
if (layoutId == R.layout.people_tile_large_with_notification_content) {
avatarSize = mHeight - (FIXED_HEIGHT_DIMENS_FOR_LARGE_NOTIF_CONTENT + (
getLineHeightFromResource(
R.dimen.content_text_size_for_large)
* 3));
return Math.min(avatarSize, getSizeInDp(
R.dimen.max_people_avatar_size_for_large_content));
} else if (layoutId == R.layout.people_tile_large_with_status_content) {
avatarSize = mHeight - (FIXED_HEIGHT_DIMENS_FOR_LARGE_STATUS_CONTENT + (
getLineHeightFromResource(R.dimen.content_text_size_for_large)
* 3));
return Math.min(avatarSize, getSizeInDp(
R.dimen.max_people_avatar_size_for_large_content));
}
if (layoutId == R.layout.people_tile_large_empty) {
int avatarHeightSpace = mHeight - (14 + 14 + getLineHeight(
getSizeInDp(R.dimen.name_text_size_for_large))
+ getLineHeight(
getSizeInDp(R.dimen.content_text_size_for_large))
+ 16 + 10 + 14);
int avatarHeightSpace = mHeight - (14 + 14 + getLineHeightFromResource(
R.dimen.name_text_size_for_large)
+ getLineHeightFromResource(R.dimen.content_text_size_for_large)
+ 16 + 10 + 16);
int avatarWidthSpace = mWidth - (14 + 14);
avatarSize = Math.min(avatarHeightSpace, avatarWidthSpace);
}
@@ -449,17 +464,28 @@ public class PeopleTileViewHelper {
}
private RemoteViews createMissedCallRemoteViews() {
RemoteViews views = getViewForContentLayout();
RemoteViews views = setViewForContentLayout(new RemoteViews(mContext.getPackageName(),
getLayoutForContent()));
views.setViewVisibility(R.id.predefined_icon, View.VISIBLE);
views.setViewVisibility(R.id.text_content, View.VISIBLE);
views.setViewVisibility(R.id.messages_count, View.GONE);
setMaxLines(views, false);
views.setTextViewText(R.id.text_content, mTile.getNotificationContent());
views.setColorAttr(R.id.text_content, "setTextColor", android.R.attr.colorError);
views.setColorAttr(R.id.predefined_icon, "setColorFilter", android.R.attr.colorError);
views.setImageViewResource(R.id.predefined_icon, R.drawable.ic_phone_missed);
if (mLayoutSize == LAYOUT_LARGE) {
views.setInt(R.id.content, "setGravity", Gravity.BOTTOM);
views.setViewLayoutHeightDimen(R.id.predefined_icon, R.dimen.large_predefined_icon);
views.setViewLayoutWidthDimen(R.id.predefined_icon, R.dimen.large_predefined_icon);
}
setAvailabilityDotPadding(views, R.dimen.availability_dot_notification_padding);
return views;
}
private RemoteViews createNotificationRemoteViews() {
RemoteViews views = getViewForContentLayout();
RemoteViews views = setViewForContentLayout(new RemoteViews(mContext.getPackageName(),
getLayoutForNotificationContent()));
CharSequence sender = mTile.getNotificationSender();
Uri image = mTile.getNotificationDataUri();
if (image != null) {
@@ -474,6 +500,11 @@ public class PeopleTileViewHelper {
views = decorateBackground(views, content);
views.setColorAttr(R.id.text_content, "setTextColor", android.R.attr.textColorPrimary);
views.setTextViewText(R.id.text_content, mTile.getNotificationContent());
if (mLayoutSize == LAYOUT_LARGE) {
views.setViewPadding(R.id.name, 0, 0, 0,
mContext.getResources().getDimensionPixelSize(
R.dimen.above_notification_text_padding));
}
views.setViewVisibility(R.id.image, View.GONE);
views.setImageViewResource(R.id.predefined_icon, R.drawable.ic_message);
}
@@ -491,6 +522,7 @@ public class PeopleTileViewHelper {
} else {
views.setViewVisibility(R.id.subtext, View.GONE);
}
setAvailabilityDotPadding(views, R.dimen.availability_dot_notification_padding);
return views;
}
@@ -513,7 +545,8 @@ public class PeopleTileViewHelper {
}
private RemoteViews createStatusRemoteViews(ConversationStatus status) {
RemoteViews views = getViewForContentLayout();
RemoteViews views = setViewForContentLayout(new RemoteViews(mContext.getPackageName(),
getLayoutForContent()));
CharSequence statusText = status.getDescription();
if (TextUtils.isEmpty(statusText)) {
statusText = getStatusTextByType(status.getActivity());
@@ -545,11 +578,27 @@ public class PeopleTileViewHelper {
android.R.attr.textColorSecondary);
setMaxLines(views, false);
}
setAvailabilityDotPadding(views, R.dimen.availability_dot_status_padding);
// TODO: Set status pre-defined icons
views.setImageViewResource(R.id.predefined_icon, R.drawable.ic_person);
return views;
}
/**
* Update the padding of the availability dot. The padding on the availability dot decreases
* on the status layouts compared to all other layouts.
*/
private void setAvailabilityDotPadding(RemoteViews views, int resId) {
boolean isLeftToRight = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault())
== View.LAYOUT_DIRECTION_LTR;
int startPadding = mContext.getResources().getDimensionPixelSize(resId);
int bottomPadding = mContext.getResources().getDimensionPixelSize(
R.dimen.medium_content_padding_above_name);
views.setViewPadding(R.id.medium_content,
isLeftToRight ? startPadding : 0, 0, isLeftToRight ? 0 : startPadding,
bottomPadding);
}
@Nullable
private ConversationStatus getBirthdayStatus(
List<ConversationStatus> statuses) {
@@ -718,9 +767,7 @@ public class PeopleTileViewHelper {
return null;
}
private RemoteViews getViewForContentLayout() {
RemoteViews views = new RemoteViews(mContext.getPackageName(),
getLayoutForContent());
private RemoteViews setViewForContentLayout(RemoteViews views) {
if (mLayoutSize == LAYOUT_SMALL) {
views.setViewVisibility(R.id.predefined_icon, View.VISIBLE);
views.setViewVisibility(R.id.name, View.GONE);
@@ -734,13 +781,34 @@ public class PeopleTileViewHelper {
}
if (mLayoutSize == LAYOUT_MEDIUM) {
// Maximize vertical padding with an avatar size of 48dp and name on medium.
if (DEBUG) Log.d(TAG, "Set vertical padding: " + mMediumVerticalPadding);
int horizontalPadding = (int) Math.floor(MAX_MEDIUM_PADDING * mDensity);
int verticalPadding = (int) Math.floor(mMediumVerticalPadding * mDensity);
views.setViewPadding(R.id.content, horizontalPadding, verticalPadding,
horizontalPadding,
verticalPadding);
// Expand the name font on medium if there's space.
int heightRequiredForMaxContentText = (int) (mContext.getResources().getDimension(
R.dimen.medium_height_for_max_name_text_size) / mDensity);
if (mHeight > heightRequiredForMaxContentText) {
views.setTextViewTextSize(R.id.name, TypedValue.COMPLEX_UNIT_PX,
(int) mContext.getResources().getDimension(
R.dimen.max_name_text_size_for_medium));
}
}
if (mLayoutSize == LAYOUT_LARGE) {
// Decrease the view padding below the name on all layouts besides notification "text".
views.setViewPadding(R.id.name, 0, 0, 0,
mContext.getResources().getDimensionPixelSize(
R.dimen.below_name_text_padding));
}
// For all layouts except Missed Calls, ensure predefined icon is regular sized.
views.setViewLayoutHeightDimen(R.id.predefined_icon, R.dimen.regular_predefined_icon);
views.setViewLayoutWidthDimen(R.id.predefined_icon, R.dimen.regular_predefined_icon);
views.setViewVisibility(R.id.messages_count, View.GONE);
if (mTile.getUserName() != null) {
views.setTextViewText(R.id.name, mTile.getUserName());
@@ -784,12 +852,24 @@ public class PeopleTileViewHelper {
}
}
private int getLayoutForNotificationContent() {
switch (mLayoutSize) {
case LAYOUT_MEDIUM:
return R.layout.people_tile_medium_with_content;
case LAYOUT_LARGE:
return R.layout.people_tile_large_with_notification_content;
case LAYOUT_SMALL:
default:
return R.layout.people_tile_small;
}
}
private int getLayoutForContent() {
switch (mLayoutSize) {
case LAYOUT_MEDIUM:
return R.layout.people_tile_medium_with_content;
case LAYOUT_LARGE:
return R.layout.people_tile_large_with_content;
return R.layout.people_tile_large_with_status_content;
case LAYOUT_SMALL:
default:
return R.layout.people_tile_small;
@@ -832,19 +912,18 @@ public class PeopleTileViewHelper {
if (durationSinceLastInteraction.toDays() <= ONE_DAY) {
return null;
} else if (durationSinceLastInteraction.toDays() < DAYS_IN_A_WEEK) {
return context.getString(R.string.timestamp, formatter.formatMeasures(
return context.getString(R.string.days_timestamp, formatter.formatMeasures(
new Measure(durationSinceLastInteraction.toDays(),
MeasureUnit.DAY)));
} else if (durationSinceLastInteraction.toDays() <= DAYS_IN_A_WEEK * 2) {
return context.getString(durationSinceLastInteraction.toDays() == DAYS_IN_A_WEEK
? R.string.timestamp : R.string.over_timestamp,
formatter.formatMeasures(
new Measure(durationSinceLastInteraction.toDays() / DAYS_IN_A_WEEK,
MeasureUnit.WEEK)));
} else if (durationSinceLastInteraction.toDays() == DAYS_IN_A_WEEK) {
return context.getString(R.string.one_week_timestamp);
} else if (durationSinceLastInteraction.toDays() < DAYS_IN_A_WEEK * 2) {
return context.getString(R.string.over_one_week_timestamp);
} else if (durationSinceLastInteraction.toDays() == DAYS_IN_A_WEEK * 2) {
return context.getString(R.string.two_weeks_timestamp);
} else {
// Over 2 weeks ago
return context.getString(R.string.over_timestamp,
formatter.formatMeasures(new Measure(MAX_WEEKS, MeasureUnit.WEEK)));
return context.getString(R.string.over_two_weeks_timestamp);
}
}
}

View File

@@ -220,8 +220,8 @@ public class PeopleSpaceUtilsTest extends SysuiTestCase {
when(mMockContext.getString(R.string.basic_status)).thenReturn(
mContext.getString(R.string.basic_status));
when(mMockContext.getPackageManager()).thenReturn(mPackageManager);
when(mMockContext.getString(R.string.over_timestamp)).thenReturn(
mContext.getString(R.string.over_timestamp));
when(mMockContext.getString(R.string.over_two_weeks_timestamp)).thenReturn(
mContext.getString(R.string.over_two_weeks_timestamp));
when(mPackageManager.getApplicationIcon(anyString())).thenReturn(null);
when(mNotificationEntryManager.getVisibleNotifications())
.thenReturn(List.of(mNotificationEntry1, mNotificationEntry2, mNotificationEntry3));

View File

@@ -148,8 +148,8 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
when(mMockContext.getString(R.string.birthday_status)).thenReturn(
mContext.getString(R.string.birthday_status));
when(mMockContext.getPackageManager()).thenReturn(mPackageManager);
when(mMockContext.getString(R.string.over_timestamp)).thenReturn(
mContext.getString(R.string.over_timestamp));
when(mMockContext.getString(R.string.over_two_weeks_timestamp)).thenReturn(
mContext.getString(R.string.over_two_weeks_timestamp));
Configuration configuration = mock(Configuration.class);
DisplayMetrics displayMetrics = mock(DisplayMetrics.class);
Resources resources = mock(Resources.class);
@@ -325,7 +325,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
TextView statusContent = (TextView) result.findViewById(R.id.text_content);
assertEquals(View.VISIBLE, statusContent.getVisibility());
assertEquals(statusContent.getText(), mContext.getString(R.string.birthday_status));
assertThat(statusContent.getMaxLines()).isEqualTo(3);
assertThat(statusContent.getMaxLines()).isEqualTo(2);
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
getSizeInDp(R.dimen.required_width_for_medium) - 1);
@@ -364,7 +364,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
statusContent = (TextView) largeResult.findViewById(R.id.text_content);
assertEquals(View.VISIBLE, statusContent.getVisibility());
assertEquals(statusContent.getText(), mContext.getString(R.string.birthday_status));
assertThat(statusContent.getMaxLines()).isEqualTo(3);
assertThat(statusContent.getMaxLines()).isEqualTo(2);
}
@Test
@@ -390,7 +390,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
// Has status.
TextView statusContent = (TextView) result.findViewById(R.id.text_content);
assertEquals(statusContent.getText(), GAME_DESCRIPTION);
assertThat(statusContent.getMaxLines()).isEqualTo(3);
assertThat(statusContent.getMaxLines()).isEqualTo(2);
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
getSizeInDp(R.dimen.required_width_for_medium) - 1);
@@ -431,7 +431,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
statusContent = (TextView) largeResult.findViewById(R.id.text_content);
assertEquals(View.VISIBLE, statusContent.getVisibility());
assertEquals(statusContent.getText(), GAME_DESCRIPTION);
assertThat(statusContent.getMaxLines()).isEqualTo(3);
assertThat(statusContent.getMaxLines()).isEqualTo(2);
}
@Test
@@ -620,7 +620,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
TextView statusContent = (TextView) result.findViewById(R.id.text_content);
assertEquals(View.VISIBLE, statusContent.getVisibility());
assertEquals(statusContent.getText(), MISSED_CALL);
assertThat(statusContent.getMaxLines()).isEqualTo(3);
assertThat(statusContent.getMaxLines()).isEqualTo(2);
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
getSizeInDp(R.dimen.required_width_for_medium) - 1);
@@ -658,7 +658,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
statusContent = (TextView) largeResult.findViewById(R.id.text_content);
assertEquals(View.VISIBLE, statusContent.getVisibility());
assertEquals(statusContent.getText(), MISSED_CALL);
assertThat(statusContent.getMaxLines()).isEqualTo(3);
assertThat(statusContent.getMaxLines()).isEqualTo(2);
}
@Test
@@ -684,7 +684,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
TextView statusContent = (TextView) result.findViewById(R.id.text_content);
assertEquals(View.VISIBLE, statusContent.getVisibility());
assertEquals(statusContent.getText(), NOTIFICATION_CONTENT);
assertThat(statusContent.getMaxLines()).isEqualTo(3);
assertThat(statusContent.getMaxLines()).isEqualTo(2);
// Has a single message, no count shown.
assertEquals(View.GONE, result.findViewById(R.id.messages_count).getVisibility());
@@ -718,7 +718,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
assertEquals(name.getText(), NAME);
assertEquals(View.GONE, largeResult.findViewById(R.id.subtext).getVisibility());
assertEquals(View.GONE, largeResult.findViewById(R.id.predefined_icon).getVisibility());
assertEquals(View.GONE, largeResult.findViewById(R.id.scrim_layout).getVisibility());
assertEquals(largeResult.findViewById(R.id.scrim_layout), null);
// Has availability.
assertEquals(View.VISIBLE, largeResult.findViewById(R.id.availability).getVisibility());
// Has person icon.
@@ -728,7 +728,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
statusContent = (TextView) largeResult.findViewById(R.id.text_content);
assertEquals(View.VISIBLE, statusContent.getVisibility());
assertEquals(statusContent.getText(), NOTIFICATION_CONTENT);
assertThat(statusContent.getMaxLines()).isEqualTo(3);
assertThat(statusContent.getMaxLines()).isEqualTo(2);
// Has a single message, no count shown.
assertEquals(View.GONE, largeResult.findViewById(R.id.messages_count).getVisibility());
@@ -761,7 +761,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
assertEquals(statusContent.getText(), NOTIFICATION_CONTENT);
// Subtract one from lines because sender is included.
assertThat(statusContent.getMaxLines()).isEqualTo(2);
assertThat(statusContent.getMaxLines()).isEqualTo(1);
// Has a single message, no count shown.
assertEquals(View.GONE, result.findViewById(R.id.messages_count).getVisibility());
@@ -808,7 +808,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
assertEquals(statusContent.getText(), NOTIFICATION_CONTENT);
// Subtract one from lines because sender is included.
assertThat(statusContent.getMaxLines()).isEqualTo(2);
assertThat(statusContent.getMaxLines()).isEqualTo(1);
// Has a single message, no count shown.
assertEquals(View.GONE, largeResult.findViewById(R.id.messages_count).getVisibility());
@@ -838,7 +838,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
TextView statusContent = (TextView) result.findViewById(R.id.text_content);
assertEquals(View.VISIBLE, statusContent.getVisibility());
assertEquals(statusContent.getText(), NOTIFICATION_CONTENT);
assertThat(statusContent.getMaxLines()).isEqualTo(3);
assertThat(statusContent.getMaxLines()).isEqualTo(2);
// Has two messages, show count.
assertEquals(View.VISIBLE, result.findViewById(R.id.messages_count).getVisibility());
@@ -881,7 +881,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
statusContent = (TextView) largeResult.findViewById(R.id.text_content);
assertEquals(View.VISIBLE, statusContent.getVisibility());
assertEquals(statusContent.getText(), NOTIFICATION_CONTENT);
assertThat(statusContent.getMaxLines()).isEqualTo(3);
assertThat(statusContent.getMaxLines()).isEqualTo(2);
// Has two messages, show count.
assertEquals(View.VISIBLE, largeResult.findViewById(R.id.messages_count).getVisibility());