Merge changes If8d5b906,I861d6ef7 into rvc-dev am: 70f970f80b am: e02dc982ff

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11871517

Change-Id: I8c67d13c5c05dd28fb759bb4578626620474406d
This commit is contained in:
Steve Elliott
2020-06-17 17:56:38 +00:00
committed by Automerger Merge Worker
3 changed files with 39 additions and 5 deletions

View File

@@ -233,13 +233,20 @@ public class ConversationLayout extends FrameLayout
oldVisibility = mImportanceRingView.getVisibility(); oldVisibility = mImportanceRingView.getVisibility();
wasGone = oldVisibility == GONE; wasGone = oldVisibility == GONE;
visibility = !mImportantConversation ? GONE : visibility; visibility = !mImportantConversation ? GONE : visibility;
isGone = visibility == GONE; boolean isRingGone = visibility == GONE;
if (wasGone != isGone) { if (wasGone != isRingGone) {
// Keep the badge visibility in sync with the icon. This is necessary in cases // 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. // Where the icon is being hidden externally like in group children.
mImportanceRingView.animate().cancel(); mImportanceRingView.animate().cancel();
mImportanceRingView.setVisibility(visibility); 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 // When the small icon is gone, hide the rest of the badge
mIcon.setOnForceHiddenChangedListener((forceHidden) -> { mIcon.setOnForceHiddenChangedListener((forceHidden) -> {

View File

@@ -42,6 +42,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.RemoteViews; import android.widget.RemoteViews;
import android.widget.TextView;
import com.android.internal.R; import com.android.internal.R;
@@ -612,7 +613,7 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou
return 0; return 0;
} }
public View getSenderView() { public TextView getSenderView() {
return mSenderView; return mSenderView;
} }
@@ -668,6 +669,7 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou
singleLine ? LinearLayout.HORIZONTAL : LinearLayout.VERTICAL); singleLine ? LinearLayout.HORIZONTAL : LinearLayout.VERTICAL);
MarginLayoutParams layoutParams = (MarginLayoutParams) mSenderView.getLayoutParams(); MarginLayoutParams layoutParams = (MarginLayoutParams) mSenderView.getLayoutParams();
layoutParams.setMarginEnd(singleLine ? mSenderTextPaddingSingleLine : 0); layoutParams.setMarginEnd(singleLine ? mSenderTextPaddingSingleLine : 0);
mSenderView.setSingleLine(singleLine);
updateMaxDisplayedLines(); updateMaxDisplayedLines();
updateClipRect(); updateClipRect();
updateSenderVisibility(); updateSenderVisibility();

View File

@@ -17,9 +17,11 @@
package com.android.systemui.statusbar.notification; package com.android.systemui.statusbar.notification;
import android.content.res.Resources; import android.content.res.Resources;
import android.text.Layout;
import android.util.Pools; import android.util.Pools;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView;
import com.android.internal.widget.IMessagingLayout; import com.android.internal.widget.IMessagingLayout;
import com.android.internal.widget.MessagingGroup; import com.android.internal.widget.MessagingGroup;
@@ -229,6 +231,15 @@ public class MessagingLayoutTransformState extends TransformState {
return result; 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. * Transform two groups towards each other.
* *
@@ -238,13 +249,20 @@ public class MessagingLayoutTransformState extends TransformState {
float transformationAmount, boolean to) { float transformationAmount, boolean to) {
boolean useLinearTransformation = boolean useLinearTransformation =
otherGroup.getIsolatedMessage() == null && !mTransformInfo.isAnimating(); otherGroup.getIsolatedMessage() == null && !mTransformInfo.isAnimating();
transformView(transformationAmount, to, ownGroup.getSenderView(), otherGroup.getSenderView(), TextView ownSenderView = ownGroup.getSenderView();
true /* sameAsAny */, useLinearTransformation); 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(), int totalAvatarTranslation = transformView(transformationAmount, to, ownGroup.getAvatar(),
otherGroup.getAvatar(), true /* sameAsAny */, useLinearTransformation); otherGroup.getAvatar(), true /* sameAsAny */, useLinearTransformation);
List<MessagingMessage> ownMessages = ownGroup.getMessages(); List<MessagingMessage> ownMessages = ownGroup.getMessages();
List<MessagingMessage> otherMessages = otherGroup.getMessages(); List<MessagingMessage> otherMessages = otherGroup.getMessages();
float previousTranslation = 0; float previousTranslation = 0;
boolean isLastView = true;
for (int i = 0; i < ownMessages.size(); i++) { for (int i = 0; i < ownMessages.size(); i++) {
View child = ownMessages.get(ownMessages.size() - 1 - i).getView(); View child = ownMessages.get(ownMessages.size() - 1 - i).getView();
if (isGone(child)) { if (isGone(child)) {
@@ -278,6 +296,9 @@ public class MessagingLayoutTransformState extends TransformState {
mMessagingLayout.setMessagingClippingDisabled(true); mMessagingLayout.setMessagingClippingDisabled(true);
} }
if (otherChild == null) { if (otherChild == null) {
if (isLastView) {
previousTranslation = ownSenderView.getTranslationY();
}
child.setTranslationY(previousTranslation); child.setTranslationY(previousTranslation);
setClippingDeactivated(child, true); setClippingDeactivated(child, true);
} else if (ownGroup.getIsolatedMessage() == child || otherIsIsolated) { } else if (ownGroup.getIsolatedMessage() == child || otherIsIsolated) {
@@ -287,6 +308,7 @@ public class MessagingLayoutTransformState extends TransformState {
} else { } else {
previousTranslation = child.getTranslationY(); previousTranslation = child.getTranslationY();
} }
isLastView = false;
} }
ownGroup.updateClipRect(); ownGroup.updateClipRect();
return totalAvatarTranslation; return totalAvatarTranslation;
@@ -382,6 +404,9 @@ public class MessagingLayoutTransformState extends TransformState {
if (view.getParent() == null) { if (view.getParent() == null) {
return true; return true;
} }
if (view.getWidth() == 0) {
return true;
}
final ViewGroup.LayoutParams lp = view.getLayoutParams(); final ViewGroup.LayoutParams lp = view.getLayoutParams();
if (lp instanceof MessagingLinearLayout.LayoutParams if (lp instanceof MessagingLinearLayout.LayoutParams
&& ((MessagingLinearLayout.LayoutParams) lp).hide) { && ((MessagingLinearLayout.LayoutParams) lp).hide) {