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

Commit ab82f094 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Updates for collapsed notifications

- collapsed notifs in a collapsed group - only one line and
show the conversation title
- collapsed notifs - 2 lines (separate flag) or 3 for summarization

Test: manual
Flag: android.app.nm_summarization
Flag: android.app.nm_collapsed_lines
Bug: 390217880
Change-Id: I4a2810b0ab67c97ca413b4d8326261c43a3d86b5
parent d04635b1
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -385,3 +385,13 @@ flag {
  description: "Shows summarized notifications in the UI"
  bug: "390217880"
}

flag {
  name: "nm_collapsed_lines"
  namespace: "systemui"
  description: "Shows 2 lines for collapsed notifications by default"
  bug: "390217880"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}
+16 −4
Original line number Diff line number Diff line
@@ -401,9 +401,19 @@ public class ConversationLayout extends FrameLayout
    @RemotableViewMethod(asyncImpl = "setIsCollapsedAsync")
    public void setIsCollapsed(boolean isCollapsed) {
        mIsCollapsed = isCollapsed;
        mMessagingLinearLayout.setMaxDisplayedLines(isCollapsed
                ? TextUtils.isEmpty(mSummarizedContent) ? 1 : MAX_SUMMARIZATION_LINES
                : Integer.MAX_VALUE);
        int maxLines = Integer.MAX_VALUE;
        if (isCollapsed) {
            if (!TextUtils.isEmpty(mSummarizedContent)) {
                maxLines = MAX_SUMMARIZATION_LINES;
            } else {
                if (android.app.Flags.nmCollapsedLines()) {
                    maxLines = 2;
                } else {
                    maxLines = 1;
                }
            }
        }
        mMessagingLinearLayout.setMaxDisplayedLines(maxLines);
        updateExpandButton();
        updateContentEndPaddings();
    }
@@ -1177,7 +1187,9 @@ public class ConversationLayout extends FrameLayout
                nameOverride = mNameReplacement;
            }
            newGroup.setShowingAvatar(!mIsOneToOne && !mIsCollapsed);
            newGroup.setSingleLine(mIsCollapsed && TextUtils.isEmpty(mSummarizedContent));
            newGroup.setSingleLine(mIsCollapsed
                    ? !android.app.Flags.nmCollapsedLines() && TextUtils.isEmpty(mSummarizedContent)
                    : false);
            newGroup.setIsCollapsed(mIsCollapsed);
            newGroup.setSender(sender, nameOverride);
            newGroup.setSending(groupIndex == (groups.size() - 1) && showSpinner);
+7 −1
Original line number Diff line number Diff line
@@ -157,6 +157,10 @@ public class MessagingLayout extends FrameLayout
    @RemotableViewMethod(asyncImpl = "setIsCollapsedAsync")
    public void setIsCollapsed(boolean isCollapsed) {
        mIsCollapsed = isCollapsed;
        if (mIsCollapsed) {
            mMessagingLinearLayout.setMaxDisplayedLines(
                    android.app.Flags.nmCollapsedLines() ? 2 : 1);
        }
    }

    /**
@@ -549,7 +553,9 @@ public class MessagingLayout extends FrameLayout
            if (sender != mUser && mNameReplacement != null) {
                nameOverride = mNameReplacement;
            }
            newGroup.setSingleLine(mIsCollapsed && TextUtils.isEmpty(mSummarizedContent));
            newGroup.setSingleLine(mIsCollapsed
                    ? !android.app.Flags.nmCollapsedLines() && TextUtils.isEmpty(mSummarizedContent)
                    : false);
            newGroup.setShowingAvatar(!mIsCollapsed);
            newGroup.setIsCollapsed(mIsCollapsed);
            newGroup.setSender(sender, nameOverride);
+1 −2
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ import java.util.Objects;
 */
public class HybridConversationNotificationView extends HybridNotificationView {

    private static final int MAX_SUMMARIZATION_LINES = 2;
    private static final int MAX_SUMMARIZATION_LINES = 1;
    private ImageView mConversationIconView;
    private TextView mConversationSenderName;
    private ViewStub mConversationFacePileStub;
@@ -295,7 +295,6 @@ public class HybridConversationNotificationView extends HybridNotificationView {
        if (AsyncHybridViewInflation.isUnexpectedlyInLegacyMode()) return;
        if (!TextUtils.isEmpty(summarization)) {
            mConversationSenderName.setVisibility(GONE);
            titleText = null;
            contentText = summarization;
            mTextView.setSingleLine(false);
            mTextView.setMaxLines(MAX_SUMMARIZATION_LINES);