From 34ccc845b1afcb3974bbe7dc4d4145f91c05d24e Mon Sep 17 00:00:00 2001 From: Joshua Tsuji Date: Fri, 29 May 2020 16:06:39 -0400 Subject: [PATCH] Set max width on sender/group name too Fixes: 157751664 Test: manual Change-Id: Ibb6f3b7cbca5565a9434840c53262284ff03fce0 --- packages/SystemUI/res/layout/bubble_flyout.xml | 2 ++ .../src/com/android/systemui/bubbles/BubbleFlyoutView.java | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/res/layout/bubble_flyout.xml b/packages/SystemUI/res/layout/bubble_flyout.xml index 7ab0a0c09f9b0..22a81357ee15c 100644 --- a/packages/SystemUI/res/layout/bubble_flyout.xml +++ b/packages/SystemUI/res/layout/bubble_flyout.xml @@ -47,6 +47,7 @@ android:layout_height="wrap_content" android:fontFamily="@*android:string/config_bodyFontFamilyMedium" android:maxLines="1" + android:ellipsize="end" android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body2"/> diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleFlyoutView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleFlyoutView.java index ca53fa7e68116..e12b325f5d052 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleFlyoutView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleFlyoutView.java @@ -230,8 +230,12 @@ public class BubbleFlyoutView extends FrameLayout { mSenderText.setTranslationX(0); } + final int maxTextViewWidth = + (int) (parentWidth * FLYOUT_MAX_WIDTH_PERCENT) - mFlyoutPadding * 2; + // Name visibility if (!TextUtils.isEmpty(flyoutMessage.senderName)) { + mSenderText.setMaxWidth(maxTextViewWidth); mSenderText.setText(flyoutMessage.senderName); mSenderText.setVisibility(VISIBLE); } else { @@ -248,8 +252,7 @@ public class BubbleFlyoutView extends FrameLayout { // Set the flyout TextView's max width in terms of percent, and then subtract out the // padding so that the entire flyout view will be the desired width (rather than the // TextView being the desired width + extra padding). - mMessageText.setMaxWidth( - (int) (parentWidth * FLYOUT_MAX_WIDTH_PERCENT) - mFlyoutPadding * 2); + mMessageText.setMaxWidth(maxTextViewWidth); mMessageText.setText(flyoutMessage.message); // Wait for the TextView to lay out so we know its line count.