diff options
3 files changed, 39 insertions, 5 deletions
diff --git a/core/java/com/android/internal/widget/ConversationLayout.java b/core/java/com/android/internal/widget/ConversationLayout.java index b64923fb5bf8..5d4407bf8370 100644 --- a/core/java/com/android/internal/widget/ConversationLayout.java +++ b/core/java/com/android/internal/widget/ConversationLayout.java @@ -233,13 +233,20 @@ public class ConversationLayout extends FrameLayout oldVisibility = mImportanceRingView.getVisibility(); wasGone = oldVisibility == GONE; visibility = !mImportantConversation ? GONE : visibility; - isGone = visibility == GONE; - if (wasGone != isGone) { + boolean isRingGone = visibility == GONE; + if (wasGone != isRingGone) { // Keep the badge visibility in sync with the icon. This is necessary in cases // Where the icon is being hidden externally like in group children. mImportanceRingView.animate().cancel(); mImportanceRingView.setVisibility(visibility); } + + oldVisibility = mConversationIconBadge.getVisibility(); + wasGone = oldVisibility == GONE; + if (wasGone != isGone) { + mConversationIconBadge.animate().cancel(); + mConversationIconBadge.setVisibility(visibility); + } }); // When the small icon is gone, hide the rest of the badge mIcon.setOnForceHiddenChangedListener((forceHidden) -> { diff --git a/core/java/com/android/internal/widget/MessagingGroup.java b/core/java/com/android/internal/widget/MessagingGroup.java index 53272f7eebf9..6d940b8ec33e 100644 --- a/core/java/com/android/internal/widget/MessagingGroup.java +++ b/core/java/com/android/internal/widget/MessagingGroup.java @@ -42,6 +42,7 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.RemoteViews; +import android.widget.TextView; import com.android.internal.R; @@ -612,7 +613,7 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou return 0; } - public View getSenderView() { + public TextView getSenderView() { return mSenderView; } @@ -668,6 +669,7 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou singleLine ? LinearLayout.HORIZONTAL : LinearLayout.VERTICAL); MarginLayoutParams layoutParams = (MarginLayoutParams) mSenderView.getLayoutParams(); layoutParams.setMarginEnd(singleLine ? mSenderTextPaddingSingleLine : 0); + mSenderView.setSingleLine(singleLine); updateMaxDisplayedLines(); updateClipRect(); updateSenderVisibility(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/MessagingLayoutTransformState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/MessagingLayoutTransformState.java index 5ee4693a32bf..e0532c3e2b28 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/MessagingLayoutTransformState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/MessagingLayoutTransformState.java @@ -17,9 +17,11 @@ package com.android.systemui.statusbar.notification; import android.content.res.Resources; +import android.text.Layout; import android.util.Pools; import android.view.View; import android.view.ViewGroup; +import android.widget.TextView; import com.android.internal.widget.IMessagingLayout; import com.android.internal.widget.MessagingGroup; @@ -229,6 +231,15 @@ public class MessagingLayoutTransformState extends TransformState { return result; } + private boolean hasEllipses(TextView textView) { + Layout layout = textView.getLayout(); + return layout != null && layout.getEllipsisCount(layout.getLineCount() - 1) > 0; + } + + private boolean needsReflow(TextView own, TextView other) { + return hasEllipses(own) != hasEllipses(other); + } + /** * Transform two groups towards each other. * @@ -238,13 +249,20 @@ public class MessagingLayoutTransformState extends TransformState { float transformationAmount, boolean to) { boolean useLinearTransformation = otherGroup.getIsolatedMessage() == null && !mTransformInfo.isAnimating(); - transformView(transformationAmount, to, ownGroup.getSenderView(), otherGroup.getSenderView(), - true /* sameAsAny */, useLinearTransformation); + TextView ownSenderView = ownGroup.getSenderView(); + TextView otherSenderView = otherGroup.getSenderView(); + transformView(transformationAmount, to, ownSenderView, otherSenderView, + // Normally this would be handled by the TextViewMessageState#sameAs check, but in + // this case it doesn't work because our text won't match, due to the appended colon + // in the collapsed view. + !needsReflow(ownSenderView, otherSenderView), + useLinearTransformation); int totalAvatarTranslation = transformView(transformationAmount, to, ownGroup.getAvatar(), otherGroup.getAvatar(), true /* sameAsAny */, useLinearTransformation); List<MessagingMessage> ownMessages = ownGroup.getMessages(); List<MessagingMessage> otherMessages = otherGroup.getMessages(); float previousTranslation = 0; + boolean isLastView = true; for (int i = 0; i < ownMessages.size(); i++) { View child = ownMessages.get(ownMessages.size() - 1 - i).getView(); if (isGone(child)) { @@ -278,6 +296,9 @@ public class MessagingLayoutTransformState extends TransformState { mMessagingLayout.setMessagingClippingDisabled(true); } if (otherChild == null) { + if (isLastView) { + previousTranslation = ownSenderView.getTranslationY(); + } child.setTranslationY(previousTranslation); setClippingDeactivated(child, true); } else if (ownGroup.getIsolatedMessage() == child || otherIsIsolated) { @@ -287,6 +308,7 @@ public class MessagingLayoutTransformState extends TransformState { } else { previousTranslation = child.getTranslationY(); } + isLastView = false; } ownGroup.updateClipRect(); return totalAvatarTranslation; @@ -382,6 +404,9 @@ public class MessagingLayoutTransformState extends TransformState { if (view.getParent() == null) { return true; } + if (view.getWidth() == 0) { + return true; + } final ViewGroup.LayoutParams lp = view.getLayoutParams(); if (lp instanceof MessagingLinearLayout.LayoutParams && ((MessagingLinearLayout.LayoutParams) lp).hide) { |