Merge "Ensured that the reply icon isn't showing on HUNS" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
d7c3ba204c
@@ -6678,7 +6678,8 @@ public class Notification implements Parcelable
|
|||||||
public RemoteViews makeContentView(boolean increasedHeight) {
|
public RemoteViews makeContentView(boolean increasedHeight) {
|
||||||
mBuilder.mOriginalActions = mBuilder.mActions;
|
mBuilder.mOriginalActions = mBuilder.mActions;
|
||||||
mBuilder.mActions = new ArrayList<>();
|
mBuilder.mActions = new ArrayList<>();
|
||||||
RemoteViews remoteViews = makeMessagingView(true /* isCollapsed */);
|
RemoteViews remoteViews = makeMessagingView(true /* displayImagesAtEnd */,
|
||||||
|
true /* showReplyIcon */);
|
||||||
mBuilder.mActions = mBuilder.mOriginalActions;
|
mBuilder.mActions = mBuilder.mOriginalActions;
|
||||||
mBuilder.mOriginalActions = null;
|
mBuilder.mOriginalActions = null;
|
||||||
return remoteViews;
|
return remoteViews;
|
||||||
@@ -6765,11 +6766,19 @@ public class Notification implements Parcelable
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public RemoteViews makeBigContentView() {
|
public RemoteViews makeBigContentView() {
|
||||||
return makeMessagingView(false /* isCollapsed */);
|
return makeMessagingView(false /* displayImagesAtEnd */, false /* showReplyIcon */);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a messaging layout.
|
||||||
|
*
|
||||||
|
* @param displayImagesAtEnd should images be displayed at the end of the content instead
|
||||||
|
* of inline.
|
||||||
|
* @param showReplyIcon Should the reply affordance be shown at the end of the notification
|
||||||
|
* @return the created remoteView.
|
||||||
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
private RemoteViews makeMessagingView(boolean isCollapsed) {
|
private RemoteViews makeMessagingView(boolean displayImagesAtEnd, boolean showReplyIcon) {
|
||||||
CharSequence conversationTitle = !TextUtils.isEmpty(super.mBigContentTitle)
|
CharSequence conversationTitle = !TextUtils.isEmpty(super.mBigContentTitle)
|
||||||
? super.mBigContentTitle
|
? super.mBigContentTitle
|
||||||
: mConversationTitle;
|
: mConversationTitle;
|
||||||
@@ -6780,24 +6789,24 @@ public class Notification implements Parcelable
|
|||||||
nameReplacement = conversationTitle;
|
nameReplacement = conversationTitle;
|
||||||
conversationTitle = null;
|
conversationTitle = null;
|
||||||
}
|
}
|
||||||
boolean hideLargeIcon = !isCollapsed || isOneToOne;
|
boolean hideLargeIcon = !showReplyIcon || isOneToOne;
|
||||||
RemoteViews contentView = mBuilder.applyStandardTemplateWithActions(
|
RemoteViews contentView = mBuilder.applyStandardTemplateWithActions(
|
||||||
mBuilder.getMessagingLayoutResource(),
|
mBuilder.getMessagingLayoutResource(),
|
||||||
mBuilder.mParams.reset().hasProgress(false).title(conversationTitle).text(null)
|
mBuilder.mParams.reset().hasProgress(false).title(conversationTitle).text(null)
|
||||||
.hideLargeIcon(hideLargeIcon)
|
.hideLargeIcon(hideLargeIcon)
|
||||||
.headerTextSecondary(conversationTitle)
|
.headerTextSecondary(conversationTitle)
|
||||||
.alwaysShowReply(isCollapsed));
|
.alwaysShowReply(showReplyIcon));
|
||||||
addExtras(mBuilder.mN.extras);
|
addExtras(mBuilder.mN.extras);
|
||||||
// also update the end margin if there is an image
|
// also update the end margin if there is an image
|
||||||
int endMargin = R.dimen.notification_content_margin_end;
|
int endMargin = R.dimen.notification_content_margin_end;
|
||||||
if (isCollapsed) {
|
if (showReplyIcon) {
|
||||||
endMargin = R.dimen.notification_content_plus_picture_margin_end;
|
endMargin = R.dimen.notification_content_plus_picture_margin_end;
|
||||||
}
|
}
|
||||||
contentView.setViewLayoutMarginEndDimen(R.id.notification_main_column, endMargin);
|
contentView.setViewLayoutMarginEndDimen(R.id.notification_main_column, endMargin);
|
||||||
contentView.setInt(R.id.status_bar_latest_event_content, "setLayoutColor",
|
contentView.setInt(R.id.status_bar_latest_event_content, "setLayoutColor",
|
||||||
mBuilder.resolveContrastColor());
|
mBuilder.resolveContrastColor());
|
||||||
contentView.setBoolean(R.id.status_bar_latest_event_content, "setIsCollapsed",
|
contentView.setBoolean(R.id.status_bar_latest_event_content, "setDisplayImagesAtEnd",
|
||||||
isCollapsed);
|
displayImagesAtEnd);
|
||||||
contentView.setIcon(R.id.status_bar_latest_event_content, "setLargeIcon",
|
contentView.setIcon(R.id.status_bar_latest_event_content, "setLargeIcon",
|
||||||
mBuilder.mN.mLargeIcon);
|
mBuilder.mN.mLargeIcon);
|
||||||
contentView.setCharSequence(R.id.status_bar_latest_event_content, "setNameReplacement",
|
contentView.setCharSequence(R.id.status_bar_latest_event_content, "setNameReplacement",
|
||||||
@@ -6864,7 +6873,8 @@ public class Notification implements Parcelable
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public RemoteViews makeHeadsUpContentView(boolean increasedHeight) {
|
public RemoteViews makeHeadsUpContentView(boolean increasedHeight) {
|
||||||
RemoteViews remoteViews = makeMessagingView(true /* isCollapsed */);
|
RemoteViews remoteViews = makeMessagingView(true /* displayImagesAtEnd */,
|
||||||
|
false /* showReplyIcon */);
|
||||||
remoteViews.setInt(R.id.notification_messaging, "setMaxDisplayedLines", 1);
|
remoteViews.setInt(R.id.notification_messaging, "setMaxDisplayedLines", 1);
|
||||||
return remoteViews;
|
return remoteViews;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou
|
|||||||
private boolean mIsHidingAnimated;
|
private boolean mIsHidingAnimated;
|
||||||
private boolean mNeedsGeneratedAvatar;
|
private boolean mNeedsGeneratedAvatar;
|
||||||
private Notification.Person mSender;
|
private Notification.Person mSender;
|
||||||
private boolean mAvatarsAtEnd;
|
private boolean mImagesAtEnd;
|
||||||
private ViewGroup mImageContainer;
|
private ViewGroup mImageContainer;
|
||||||
private MessagingImageMessage mIsolatedMessage;
|
private MessagingImageMessage mIsolatedMessage;
|
||||||
private boolean mTransformingImages;
|
private boolean mTransformingImages;
|
||||||
@@ -342,7 +342,7 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou
|
|||||||
mAddedMessages.add(message);
|
mAddedMessages.add(message);
|
||||||
}
|
}
|
||||||
boolean isImage = message instanceof MessagingImageMessage;
|
boolean isImage = message instanceof MessagingImageMessage;
|
||||||
if (mAvatarsAtEnd && isImage) {
|
if (mImagesAtEnd && isImage) {
|
||||||
isolatedMessage = (MessagingImageMessage) message;
|
isolatedMessage = (MessagingImageMessage) message;
|
||||||
} else {
|
} else {
|
||||||
if (removeFromParentIfDifferent(message, mMessageContainer)) {
|
if (removeFromParentIfDifferent(message, mMessageContainer)) {
|
||||||
@@ -474,9 +474,9 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou
|
|||||||
mTransformingImages = transformingImages;
|
mTransformingImages = transformingImages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDisplayAvatarsAtEnd(boolean atEnd) {
|
public void setDisplayImagesAtEnd(boolean atEnd) {
|
||||||
if (mAvatarsAtEnd != atEnd) {
|
if (mImagesAtEnd != atEnd) {
|
||||||
mAvatarsAtEnd = atEnd;
|
mImagesAtEnd = atEnd;
|
||||||
mImageContainer.setVisibility(atEnd ? View.VISIBLE : View.GONE);
|
mImageContainer.setVisibility(atEnd ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class MessagingLayout extends FrameLayout {
|
|||||||
private ArrayList<MessagingGroup> mAddedGroups = new ArrayList<>();
|
private ArrayList<MessagingGroup> mAddedGroups = new ArrayList<>();
|
||||||
private Notification.Person mUser;
|
private Notification.Person mUser;
|
||||||
private CharSequence mNameReplacement;
|
private CharSequence mNameReplacement;
|
||||||
private boolean mIsCollapsed;
|
private boolean mDisplayImagesAtEnd;
|
||||||
|
|
||||||
public MessagingLayout(@NonNull Context context) {
|
public MessagingLayout(@NonNull Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
@@ -128,8 +128,8 @@ public class MessagingLayout extends FrameLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RemotableViewMethod
|
@RemotableViewMethod
|
||||||
public void setIsCollapsed(boolean isCollapsed) {
|
public void setDisplayImagesAtEnd(boolean atEnd) {
|
||||||
mIsCollapsed = isCollapsed;
|
mDisplayImagesAtEnd = atEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RemotableViewMethod
|
@RemotableViewMethod
|
||||||
@@ -337,7 +337,7 @@ public class MessagingLayout extends FrameLayout {
|
|||||||
newGroup = MessagingGroup.createGroup(mMessagingLinearLayout);
|
newGroup = MessagingGroup.createGroup(mMessagingLinearLayout);
|
||||||
mAddedGroups.add(newGroup);
|
mAddedGroups.add(newGroup);
|
||||||
}
|
}
|
||||||
newGroup.setDisplayAvatarsAtEnd(mIsCollapsed);
|
newGroup.setDisplayImagesAtEnd(mDisplayImagesAtEnd);
|
||||||
newGroup.setLayoutColor(mLayoutColor);
|
newGroup.setLayoutColor(mLayoutColor);
|
||||||
Notification.Person sender = senders.get(groupIndex);
|
Notification.Person sender = senders.get(groupIndex);
|
||||||
CharSequence nameOverride = null;
|
CharSequence nameOverride = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user