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

Commit 87094c4d authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Set avatar visibility based on collapsed state" into main

parents 055d5a8a cc123a07
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1178,6 +1178,7 @@ public class ConversationLayout extends FrameLayout
            }
            newGroup.setShowingAvatar(!mIsOneToOne && !mIsCollapsed);
            newGroup.setSingleLine(mIsCollapsed && TextUtils.isEmpty(mSummarizedContent));
            newGroup.setIsCollapsed(mIsCollapsed);
            newGroup.setSender(sender, nameOverride);
            newGroup.setSending(groupIndex == (groups.size() - 1) && showSpinner);
            mGroups.add(newGroup);
+11 −2
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ public class MessagingGroup extends NotificationOptimizedLinearLayout implements
    private boolean mShowingAvatar = true;
    private CharSequence mSenderName;
    private boolean mSingleLine = false;
    private boolean mIsCollapsed = false;
    private LinearLayout mContentContainer;
    private int mRequestedMaxDisplayedLines = Integer.MAX_VALUE;
    private int mSenderTextPaddingSingleLine;
@@ -451,7 +452,7 @@ public class MessagingGroup extends NotificationOptimizedLinearLayout implements
    private void updateIconVisibility() {
        if (Flags.notificationsRedesignTemplates()) {
            // We don't show any icon (other than the app or person icon) in the collapsed form.
            mMessagingIconContainer.setVisibility(mSingleLine ? GONE : VISIBLE);
            mMessagingIconContainer.setVisibility(mIsCollapsed ? GONE : VISIBLE);
        }
    }

@@ -714,10 +715,18 @@ public class MessagingGroup extends NotificationOptimizedLinearLayout implements
            updateMaxDisplayedLines();
            updateClipRect();
            updateSenderVisibility();
            updateIconVisibility();
        }
    }

    /**
     * Sets whether this is in a collapsed layout or not. Certain elements like icons are not shown
     * when the notification is collapsed.
     */
    public void setIsCollapsed(boolean isCollapsed) {
        mIsCollapsed = isCollapsed;
        updateIconVisibility();
    }

    public boolean isSingleLine() {
        return mSingleLine;
    }
+1 −0
Original line number Diff line number Diff line
@@ -551,6 +551,7 @@ public class MessagingLayout extends FrameLayout
            }
            newGroup.setSingleLine(mIsCollapsed && TextUtils.isEmpty(mSummarizedContent));
            newGroup.setShowingAvatar(!mIsCollapsed);
            newGroup.setIsCollapsed(mIsCollapsed);
            newGroup.setSender(sender, nameOverride);
            newGroup.setSending(groupIndex == (groups.size() - 1) && showSpinner);
            mGroups.add(newGroup);
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ public class PeopleHelper {
    @NonNull
    public Icon createAvatarSymbol(@NonNull CharSequence name, @NonNull String symbol,
            @ColorInt int layoutColor) {
        if (symbol.isEmpty() || TextUtils.isDigitsOnly(symbol)
        if (symbol == null || symbol.isEmpty() || TextUtils.isDigitsOnly(symbol)
                || SPECIAL_CHAR_PATTERN.matcher(symbol).find()) {
            Icon avatarIcon = Icon.createWithResource(mContext, R.drawable.messaging_user);
            avatarIcon.setTint(findColor(name, layoutColor));