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

Commit 815f7632 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add application name to expanded conversation view" into rvc-dev am: eb0d8bff

Change-Id: I77eaeb0a0e62b2d3c3e796a2f8ea0c0bde432c57
parents 0ad6de33 eb0d8bff
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