From 5365337bba704796dfadb0f0ea251795fcfae73f Mon Sep 17 00:00:00 2001 From: 1 Date: Tue, 9 May 2023 18:08:38 +0000 Subject: Allow chooser targets to use two lines Previous behavior is that direct share would get two lines but app targets got one line for the label and one line for the sub-label. This forced truncation of labels even when no sub-label was present (see bug). This change evolves that by making the following changes: 1. Set the maxLines of the label instead of lines directly. 2. If there's no sublabel, set maxLines to 2. 3. Change the grid item's gravity so they're top-aligned (previously they were all the same height yet centered). Setting the line count directly didn't work because the compound drawable would always be drawn as if there were two lines. One subtlety here is that a row of targets that all fit within a single line will have less space between icons. Bug: 280289219 Test: atest UnbundledChooserActivityTest Test: manual review how a variety of targets render. Change-Id: Id9831a310738631c9f767827fec595117ac3a487 --- java/res/layout/resolve_grid_item.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'java/res/layout') diff --git a/java/res/layout/resolve_grid_item.xml b/java/res/layout/resolve_grid_item.xml index 4cf7d04b..fb2614a0 100644 --- a/java/res/layout/resolve_grid_item.xml +++ b/java/res/layout/resolve_grid_item.xml @@ -23,7 +23,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="100dp" - android:gravity="center" + android:gravity="top" android:paddingTop="@dimen/grid_padding_top" android:paddingBottom="12dp" android:paddingHorizontal="4dp" @@ -53,7 +53,7 @@ android:textColor="?androidprv:attr/materialColorOnSurface" android:textSize="12sp" android:gravity="top|center_horizontal" - android:lines="1" + android:maxLines="1" android:ellipsize="end" /> -- cgit v1.2.3-59-g8ed1b