diff options
| author | 2025-03-04 17:03:51 +0100 | |
|---|---|---|
| committer | 2025-03-04 17:03:51 +0100 | |
| commit | 8d0104f70f11d5496eeece1dc970688592362aa5 (patch) | |
| tree | 6a163e0e26507d3fa93dbfa2ed08cdee078191a8 | |
| parent | 113979e476ec3021778b8bf023c74ebd72575314 (diff) | |
[Notif redesign] Fix text cutoff
On larger font sizes, the bottom of letters like g, y and accented
characters could get cut off due to the fixed height.
This fixes that issue by using minHeight instead, and setting the height
to wrap_content. It also simplifies our templates a little bit, and
fixes a bug where the old media style wasn't using the new
notification_2025_text layout.
Bug: 378660052
Test: manually increased the font size and verified that text doesn't get cut off anymore
Flag: android.app.notifications_redesign_templates
Change-Id: I7a465fa9b4cfd27ff5fed8358572ba17031e26d2
4 files changed, 8 insertions, 30 deletions
diff --git a/core/res/res/layout/notification_2025_template_collapsed_base.xml b/core/res/res/layout/notification_2025_template_collapsed_base.xml index e9e3edbc86dd..dc6cf0457f4a 100644 --- a/core/res/res/layout/notification_2025_template_collapsed_base.xml +++ b/core/res/res/layout/notification_2025_template_collapsed_base.xml @@ -125,15 +125,7 @@ android:layout_marginBottom="@dimen/notification_2025_additional_margin" android:minHeight="@dimen/notification_headerless_line_height" > - <!-- This is the simplest way to keep this text vertically centered without - gravity="center_vertical" which causes jumpiness in expansion animations. --> - <include - layout="@layout/notification_2025_text" - android:layout_width="match_parent" - android:layout_height="@dimen/notification_text_height" - android:layout_gravity="center_vertical" - android:layout_marginTop="0dp" - /> + <include layout="@layout/notification_2025_text" /> </com.android.internal.widget.NotificationVanishingFrameLayout> <include diff --git a/core/res/res/layout/notification_2025_template_collapsed_call.xml b/core/res/res/layout/notification_2025_template_collapsed_call.xml index ee691e4d6894..ba45e1ab07a1 100644 --- a/core/res/res/layout/notification_2025_template_collapsed_call.xml +++ b/core/res/res/layout/notification_2025_template_collapsed_call.xml @@ -128,15 +128,7 @@ android:layout_height="wrap_content" android:minHeight="@dimen/notification_headerless_line_height" > - <!-- This is the simplest way to keep this text vertically centered without - gravity="center_vertical" which causes jumpiness in expansion animations. --> - <include - layout="@layout/notification_2025_text" - android:layout_width="match_parent" - android:layout_height="@dimen/notification_text_height" - android:layout_gravity="center_vertical" - android:layout_marginTop="0dp" - /> + <include layout="@layout/notification_2025_text" /> </com.android.internal.widget.NotificationVanishingFrameLayout> </LinearLayout> diff --git a/core/res/res/layout/notification_2025_template_collapsed_media.xml b/core/res/res/layout/notification_2025_template_collapsed_media.xml index 91a44221b4c4..8a91409bc4ce 100644 --- a/core/res/res/layout/notification_2025_template_collapsed_media.xml +++ b/core/res/res/layout/notification_2025_template_collapsed_media.xml @@ -126,15 +126,7 @@ android:layout_marginBottom="@dimen/notification_2025_additional_margin" android:layout_height="@dimen/notification_headerless_line_height" > - <!-- This is the simplest way to keep this text vertically centered without - gravity="center_vertical" which causes jumpiness in expansion animations. --> - <include - layout="@layout/notification_template_text" - android:layout_width="match_parent" - android:layout_height="@dimen/notification_text_height" - android:layout_gravity="center_vertical" - android:layout_marginTop="0dp" - /> + <include layout="@layout/notification_2025_text" /> </com.android.internal.widget.NotificationVanishingFrameLayout> <include diff --git a/core/res/res/layout/notification_2025_text.xml b/core/res/res/layout/notification_2025_text.xml index 474f6d2099c6..a725de44b0bf 100644 --- a/core/res/res/layout/notification_2025_text.xml +++ b/core/res/res/layout/notification_2025_text.xml @@ -13,14 +13,16 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> +<!-- Note that we prefer layout_gravity="center_vertical" over gravity="center_vertical", since the + latter can cause jumpiness in expansion animations. --> <com.android.internal.widget.ImageFloatingTextView xmlns:android="http://schemas.android.com/apk/res/android" style="@style/Widget.DeviceDefault.Notification.Text" android:id="@+id/text" android:layout_width="match_parent" - android:layout_height="@dimen/notification_text_height" - android:layout_gravity="top" - android:layout_marginTop="@dimen/notification_text_margin_top" + android:layout_height="wrap_content" + android:minHeight="@dimen/notification_text_height" + android:layout_gravity="center_vertical" android:ellipsize="end" android:fadingEdge="horizontal" android:gravity="top" |