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

Commit 49eebfe3 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[AOD RONs] Make conversation icon margins symmetrical" into main

parents 691fc849 04f8ef60
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -294,7 +294,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 {
@@ -304,14 +304,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)
@@ -338,11 +338,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)
@@ -502,8 +502,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)
    }

@@ -531,6 +530,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 })
    }