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

Commit 4008c23c authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Show summary in single line hybrid view

Test: SingleLineViewInflaterTest
Test: SingleLineViewBinderTest
Flag: android.app.nm_summarization
Bug: 391931283
Change-Id: Ib7ba44e309ba3f3e4ee8c30f3e5df6ed51f03274
parent d49564bc
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -288,15 +288,22 @@ public class HybridConversationNotificationView extends HybridNotificationView {
    public void setText(
            CharSequence titleText,
            CharSequence contentText,
            CharSequence conversationSenderName
            CharSequence conversationSenderName,
            @Nullable String summarization
    ) {
        if (AsyncHybridViewInflation.isUnexpectedlyInLegacyMode()) return;
        if (summarization != null) {
            mConversationSenderName.setVisibility(GONE);
            titleText = null;
            contentText = summarization;
        } else {
            if (conversationSenderName == null) {
                mConversationSenderName.setVisibility(GONE);
            } else {
                mConversationSenderName.setVisibility(VISIBLE);
                mConversationSenderName.setText(conversationSenderName);
            }
        }
        // TODO (b/217799515): super.bind() doesn't use contentView, remove the contentView
        //  argument when the flag is removed
        super.bind(/* title = */ titleText, /* text = */ contentText, /* contentView = */ null);
+8 −4
Original line number Diff line number Diff line
@@ -217,7 +217,8 @@ public class NotificationContentInflater implements NotificationRowContentBinder
                            messagingStyle,
                            builder,
                            row.getContext(),
                            false
                            false,
                            entry.getRanking().getSummarization()
                    );
            // If the messagingStyle is null, we want to inflate the normal view
            isConversation = viewModel.isConversation();
@@ -239,7 +240,8 @@ public class NotificationContentInflater implements NotificationRowContentBinder
                                messagingStyle,
                                builder,
                                row.getContext(),
                                true);
                                true,
                                entry.getRanking().getSummarization());
            } else {
                result.mPublicInflatedSingleLineViewModel =
                        SingleLineViewInflater.inflateRedactedSingleLineViewModel(
@@ -1318,7 +1320,8 @@ public class NotificationContentInflater implements NotificationRowContentBinder
                                messagingStyle,
                                recoveredBuilder,
                                mContext,
                                false
                                false,
                                mEntry.getRanking().getSummarization()
                        );
                result.mInflatedSingleLineView =
                        SingleLineViewInflater.inflatePrivateSingleLineView(
@@ -1338,7 +1341,8 @@ public class NotificationContentInflater implements NotificationRowContentBinder
                                    messagingStyle,
                                    recoveredBuilder,
                                    mContext,
                                    true
                                    true,
                                    null
                            );
                } else {
                    result.mPublicInflatedSingleLineViewModel =
+2 −0
Original line number Diff line number Diff line
@@ -719,6 +719,7 @@ constructor(
                        builder = builder,
                        systemUiContext = systemUiContext,
                        redactText = false,
                        summarization = entry.ranking.summarization
                    )
                } else null

@@ -735,6 +736,7 @@ constructor(
                            builder = builder,
                            systemUiContext = systemUiContext,
                            redactText = true,
                            summarization = null
                        )
                    } else {
                        SingleLineViewInflater.inflateRedactedSingleLineViewModel(
+3 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ internal object SingleLineViewInflater {
        builder: Notification.Builder,
        systemUiContext: Context,
        redactText: Boolean,
        summarization: String?
    ): SingleLineViewModel {
        if (AsyncHybridViewInflation.isUnexpectedlyInLegacyMode()) {
            return SingleLineViewModel(null, null, null)
@@ -108,6 +109,7 @@ internal object SingleLineViewInflater {
                conversationSenderName =
                    if (isGroupConversation) conversationTextData?.senderName else null,
                avatar = conversationAvatar,
                summarization = summarization
            )

        return SingleLineViewModel(
@@ -132,6 +134,7 @@ internal object SingleLineViewInflater {
                                .ic_redacted_notification_single_line_icon
                        )
                    ),
                    null
                )
            } else {
                null
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ object SingleLineViewBinder {
                viewModel?.titleText,
                viewModel?.contentText,
                viewModel?.conversationData?.conversationSenderName,
                viewModel?.conversationData?.summarization
            )
        } else {
            // bind the title and content text views
Loading