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

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

Change-Id: I79003668ce462426271eb80720397b03563f3c1b
This commit is contained in:
Steve Elliott
2020-06-17 17:49:14 +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();
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) -> {

View File

@@ -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();

View File

@@ -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) {