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

Commit 52440e98 authored by Steve Elliott's avatar Steve Elliott
Browse files

Add application name to expanded conversation view

Bug: 150905003
Test: manual
Change-Id: Ibb16717028498c508beda423a76375499a6f6ad9
parent 928bb16c
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -133,6 +133,7 @@ public class ConversationLayout extends FrameLayout
    private boolean mExpandable = true;
    private int mContentMarginEnd;
    private Rect mMessagingClipRect;
    private TextView mAppName;

    public ConversationLayout(@NonNull Context context) {
        super(context);
@@ -202,6 +203,7 @@ public class ConversationLayout extends FrameLayout
                R.string.conversation_title_fallback_one_to_one);
        mFallbackGroupChatName = getResources().getString(
                R.string.conversation_title_fallback_group_chat);
        mAppName = findViewById(R.id.app_name_text);
    }

    @RemotableViewMethod
@@ -384,6 +386,7 @@ public class ConversationLayout extends FrameLayout
        }
        updateIconPositionAndSize();
        updateImageMessages();
        updateAppName();
    }

    private void updateImageMessages() {
@@ -462,6 +465,10 @@ public class ConversationLayout extends FrameLayout
        topView.setImageIcon(secondLastIcon);
    }

    private void updateAppName() {
        mAppName.setVisibility(mIsCollapsed ? GONE : VISIBLE);
    }

    /**
     * update the icon position and sizing
     */
+11 −0
Original line number Diff line number Diff line
@@ -174,6 +174,17 @@
                    />
                </LinearLayout>

                <!-- App Name -->
                <TextView
                    android:id="@+id/app_name_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="@dimen/conversation_content_start"
                    android:paddingBottom="16dp"
                    android:textSize="12sp"
                    android:textAppearance="@style/TextAppearance.DeviceDefault.Notification"
                />

                <!-- Messages -->
                <com.android.internal.widget.MessagingLinearLayout
                    android:id="@+id/notification_messaging"
+13 −19
Original line number Diff line number Diff line
@@ -52,28 +52,22 @@ class NotificationConversationTemplateViewWrapper constructor(
    private lateinit var imageMessageContainer: ViewGroup
    private lateinit var messagingLinearLayout: MessagingLinearLayout
    private lateinit var importanceRing: View
    private lateinit var appName: View

    private fun resolveViews() {
        messagingLinearLayout = conversationLayout.messagingLinearLayout
        imageMessageContainer = conversationLayout.imageMessageContainer
        conversationIcon = conversationLayout.requireViewById(
                com.android.internal.R.id.conversation_icon
        )
        conversationBadge = conversationLayout.requireViewById(
                com.android.internal.R.id.conversation_icon_badge
        )
        conversationBadgeBg = conversationLayout.requireViewById(
                com.android.internal.R.id.conversation_icon_badge_bg
        )
        expandButton = conversationLayout.requireViewById(
                com.android.internal.R.id.expand_button
        )
        expandButtonContainer = conversationLayout.requireViewById(
                com.android.internal.R.id.expand_button_container
        )
        importanceRing = conversationLayout.requireViewById(
                com.android.internal.R.id.conversation_icon_badge_ring
        )
        with(conversationLayout) {
            conversationIcon = requireViewById(com.android.internal.R.id.conversation_icon)
            conversationBadge = requireViewById(com.android.internal.R.id.conversation_icon_badge)
            conversationBadgeBg =
                    requireViewById(com.android.internal.R.id.conversation_icon_badge_bg)
            expandButton = requireViewById(com.android.internal.R.id.expand_button)
            expandButtonContainer =
                    requireViewById(com.android.internal.R.id.expand_button_container)
            importanceRing = requireViewById(com.android.internal.R.id.conversation_icon_badge_ring)
            appName = requireViewById(com.android.internal.R.id.app_name_text)
        }
    }

    override fun onContentUpdated(row: ExpandableNotificationRow) {
@@ -87,7 +81,7 @@ class NotificationConversationTemplateViewWrapper constructor(
        // This also clears the existing types
        super.updateTransformedTypes()

        addTransformedViews(messagingLinearLayout)
        addTransformedViews(messagingLinearLayout, appName)

        // Let's ignore the image message container since that is transforming as part of the
        // messages already