Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7c3ba20 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Ensured that the reply icon isn't showing on HUNS" into pi-dev

parents 203bbbf9 85d0e6ed
Loading
Loading
Loading
Loading
+19 −9
Original line number Diff line number Diff line
@@ -6678,7 +6678,8 @@ public class Notification implements Parcelable
        public RemoteViews makeContentView(boolean increasedHeight) {
            mBuilder.mOriginalActions = mBuilder.mActions;
            mBuilder.mActions = new ArrayList<>();
            RemoteViews remoteViews = makeMessagingView(true /* isCollapsed */);
            RemoteViews remoteViews = makeMessagingView(true /* displayImagesAtEnd */,
                    true /* showReplyIcon */);
            mBuilder.mActions = mBuilder.mOriginalActions;
            mBuilder.mOriginalActions = null;
            return remoteViews;
@@ -6765,11 +6766,19 @@ public class Notification implements Parcelable
         */
        @Override
        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
        private RemoteViews makeMessagingView(boolean isCollapsed) {
        private RemoteViews makeMessagingView(boolean displayImagesAtEnd, boolean showReplyIcon) {
            CharSequence conversationTitle = !TextUtils.isEmpty(super.mBigContentTitle)
                    ? super.mBigContentTitle
                    : mConversationTitle;
@@ -6780,24 +6789,24 @@ public class Notification implements Parcelable
                nameReplacement = conversationTitle;
                conversationTitle = null;
            }
            boolean hideLargeIcon = !isCollapsed || isOneToOne;
            boolean hideLargeIcon = !showReplyIcon || isOneToOne;
            RemoteViews contentView = mBuilder.applyStandardTemplateWithActions(
                    mBuilder.getMessagingLayoutResource(),
                    mBuilder.mParams.reset().hasProgress(false).title(conversationTitle).text(null)
                            .hideLargeIcon(hideLargeIcon)
                            .headerTextSecondary(conversationTitle)
                            .alwaysShowReply(isCollapsed));
                            .alwaysShowReply(showReplyIcon));
            addExtras(mBuilder.mN.extras);
            // also update the end margin if there is an image
            int endMargin = R.dimen.notification_content_margin_end;
            if (isCollapsed) {
            if (showReplyIcon) {
                endMargin = R.dimen.notification_content_plus_picture_margin_end;
            }
            contentView.setViewLayoutMarginEndDimen(R.id.notification_main_column, endMargin);
            contentView.setInt(R.id.status_bar_latest_event_content, "setLayoutColor",
                    mBuilder.resolveContrastColor());
            contentView.setBoolean(R.id.status_bar_latest_event_content, "setIsCollapsed",
                    isCollapsed);
            contentView.setBoolean(R.id.status_bar_latest_event_content, "setDisplayImagesAtEnd",
                    displayImagesAtEnd);
            contentView.setIcon(R.id.status_bar_latest_event_content, "setLargeIcon",
                    mBuilder.mN.mLargeIcon);
            contentView.setCharSequence(R.id.status_bar_latest_event_content, "setNameReplacement",
@@ -6864,7 +6873,8 @@ public class Notification implements Parcelable
         */
        @Override
        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);
            return remoteViews;
        }
+5 −5
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou
    private boolean mIsHidingAnimated;
    private boolean mNeedsGeneratedAvatar;
    private Notification.Person mSender;
    private boolean mAvatarsAtEnd;
    private boolean mImagesAtEnd;
    private ViewGroup mImageContainer;
    private MessagingImageMessage mIsolatedMessage;
    private boolean mTransformingImages;
@@ -342,7 +342,7 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou
                mAddedMessages.add(message);
            }
            boolean isImage = message instanceof MessagingImageMessage;
            if (mAvatarsAtEnd && isImage) {
            if (mImagesAtEnd && isImage) {
                isolatedMessage = (MessagingImageMessage) message;
            } else {
                if (removeFromParentIfDifferent(message, mMessageContainer)) {
@@ -474,9 +474,9 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou
        mTransformingImages = transformingImages;
    }

    public void setDisplayAvatarsAtEnd(boolean atEnd) {
        if (mAvatarsAtEnd != atEnd) {
            mAvatarsAtEnd = atEnd;
    public void setDisplayImagesAtEnd(boolean atEnd) {
        if (mImagesAtEnd != atEnd) {
            mImagesAtEnd = atEnd;
            mImageContainer.setVisibility(atEnd ? View.VISIBLE : View.GONE);
        }
    }
+4 −4
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ public class MessagingLayout extends FrameLayout {
    private ArrayList<MessagingGroup> mAddedGroups = new ArrayList<>();
    private Notification.Person mUser;
    private CharSequence mNameReplacement;
    private boolean mIsCollapsed;
    private boolean mDisplayImagesAtEnd;

    public MessagingLayout(@NonNull Context context) {
        super(context);
@@ -128,8 +128,8 @@ public class MessagingLayout extends FrameLayout {
    }

    @RemotableViewMethod
    public void setIsCollapsed(boolean isCollapsed) {
        mIsCollapsed = isCollapsed;
    public void setDisplayImagesAtEnd(boolean atEnd) {
        mDisplayImagesAtEnd = atEnd;
    }

    @RemotableViewMethod
@@ -337,7 +337,7 @@ public class MessagingLayout extends FrameLayout {
                newGroup = MessagingGroup.createGroup(mMessagingLinearLayout);
                mAddedGroups.add(newGroup);
            }
            newGroup.setDisplayAvatarsAtEnd(mIsCollapsed);
            newGroup.setDisplayImagesAtEnd(mDisplayImagesAtEnd);
            newGroup.setLayoutColor(mLayoutColor);
            Notification.Person sender = senders.get(groupIndex);
            CharSequence nameOverride = null;