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

Commit 6095ec08 authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

[Notif redesign] Fix alignment in collapsed old messaging notif

I wanted to avoid adding more logic that's different between
conversations and old messaging style, but unfortunately without
rethinking how conversations are laid out it doesn't quite work. The
same messaging_group view already has a margin from the parent in the
collapsed messaging style, but not in conversations.

Bug: 378660052
Test: visual test, screenshot tests to come later
Flag: android.app.notifications_redesign_templates
Change-Id: Ic9f4919e959e90302a13005c4846989c4e035997
parent b60508f4
Loading
Loading
Loading
Loading
+20 −5
Original line number Diff line number Diff line
@@ -448,6 +448,17 @@ public class MessagingGroup extends NotificationOptimizedLinearLayout implements
        mSenderView.setVisibility(hidden ? GONE : VISIBLE);
    }

    private void updateIconVisibility() {
        if (Flags.notificationsRedesignTemplates() && !mIsInConversation) {
            // We don't show any icon (other than the app icon) in the collapsed form. For
            // conversations, keeping this container helps with aligning the message to the icon
            // when collapsed, but the old messaging style already has this alignment built into
            // the template like all other layouts. Conversations are special because we use the
            // same base layout for both the collapsed and expanded views.
            mMessagingIconContainer.setVisibility(mSingleLine ? GONE : VISIBLE);
        }
    }

    @Override
    public boolean hasDifferentHeightWhenFirst() {
        return mCanHideSenderIfFirst && !mSingleLine && !TextUtils.isEmpty(mSenderName);
@@ -703,6 +714,7 @@ public class MessagingGroup extends NotificationOptimizedLinearLayout implements
            updateMaxDisplayedLines();
            updateClipRect();
            updateSenderVisibility();
            updateIconVisibility();
        }
    }

@@ -716,13 +728,16 @@ public class MessagingGroup extends NotificationOptimizedLinearLayout implements
     * @param isInConversation is this in a conversation
     */
    public void setIsInConversation(boolean isInConversation) {
        if (mIsInConversation != isInConversation) {
            mIsInConversation = isInConversation;

            if (Flags.notificationsRedesignTemplates()) {
            // No alignment adjustments are necessary in the redesign, as the size of the icons
            // in both conversations and old messaging notifications are the same.
                updateIconVisibility();
                // No other alignment adjustments are necessary in the redesign, as the size of the
                // icons in both conversations and old messaging notifications are the same.
                return;
            }
        if (mIsInConversation != isInConversation) {
            mIsInConversation = isInConversation;

            MarginLayoutParams layoutParams =
                    (MarginLayoutParams) mMessagingIconContainer.getLayoutParams();
            layoutParams.width = mIsInConversation