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

Commit 04f8ef60 authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

[AOD RONs] Make conversation icon margins symmetrical

The default conversation icon has only left, top, right margins to leave space for the actions container, but we don't use actions in AOD RONs anyway so we can make the margins symmetrical to improve the alignment.

Fix: 402149684
Test: manual
Flag: android.app.ui_rich_ongoing
Change-Id: Ia6362d54a0669e0dbae2d8b43d3624d6acfaa7e1
parent 164e4059
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -285,7 +285,7 @@ private class AODPromotedNotificationViewUpdater(root: View) {
    private val largeIconSizePx: Int =
        root.context.resources.getDimensionPixelSize(R.dimen.notification_right_icon_size)

    private val endMarginPx: Int =
    private val marginPx: Int =
        if (notificationsRedesignTemplates()) {
            root.context.resources.getDimensionPixelSize(R.dimen.notification_2025_margin)
        } else {
@@ -295,14 +295,14 @@ private class AODPromotedNotificationViewUpdater(root: View) {
        }

    private val imageEndMarginPx: Int
        get() = largeIconSizePx + 2 * endMarginPx
        get() = largeIconSizePx + 2 * marginPx

    private val PromotedNotificationContentModel.imageEndMarginPxIfHasLargeIcon: Int
        get() =
            if (!skeletonLargeIcon.isNullOrEmpty()) {
                imageEndMarginPx
            } else {
                endMarginPx
                marginPx
            }

    private data class SmallIconSavedState(val background: Drawable?, val padding: Rect)
@@ -329,11 +329,11 @@ private class AODPromotedNotificationViewUpdater(root: View) {
        rightIcon?.setRightIconState(
            width = largeIconSizePx,
            height = largeIconSizePx,
            marginEnd = endMarginPx,
            marginEnd = marginPx,
        )

        bigText?.setImageEndMargin(largeIconSizePx + endMarginPx)
        text?.setImageEndMargin(largeIconSizePx + endMarginPx)
        bigText?.setImageEndMargin(largeIconSizePx + marginPx)
        text?.setImageEndMargin(largeIconSizePx + marginPx)

        setTextViewColor(appNameDivider, SecondaryText)
        setTextViewColor(headerTextDivider, SecondaryText)
@@ -493,8 +493,7 @@ private class AODPromotedNotificationViewUpdater(root: View) {
        updateConversationHeaderDividers(content, hideTitle = true, hideAppName = collapsed)

        updateTopLine(content)

        updateNotifIcon(conversationIcon, content.skeletonNotifIcon, content.iconLevel)
        updateConversationIcon(content)
        updateTitle(conversationText, content)
    }

@@ -522,6 +521,14 @@ private class AODPromotedNotificationViewUpdater(root: View) {
        verificationDivider?.isVisible = showDividerBeforeVerification
    }

    private fun updateConversationIcon(content: PromotedNotificationContentModel) {
        updateNotifIcon(conversationIcon, content.skeletonNotifIcon, content.iconLevel)
        (conversationIcon?.layoutParams as? MarginLayoutParams)?.let {
            it.bottomMargin = marginPx
            conversationIcon?.layoutParams = it
        }
    }

    private fun updateAppName(content: PromotedNotificationContentModel, forceHide: Boolean) {
        updateTextView(appNameText, content.appName?.takeUnless { forceHide })
    }