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

Commit 37507ae2 authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

[Notif redesign] Update size and position of conversation icon badge

We were previously updating the margins here in code behind the app
icons flag, but now that we have the forked templates we can do it there
directly (and it applies to both call layout and conversation layout).
These should be the same regardless of whether we're showing the small
icon or app icon.

Bug: 378660052
Test: visual test, screenshot tests to come later
Flag: android.app.notifications_redesign_templates
Flag: android.app.notifications_redesign_app_icons
Change-Id: I51d4c34c8671c996f7573f58363b85d1b3b8d5b9
parent 7e50f267
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -52,11 +52,20 @@
            android:id="@+id/conversation_face_pile"
            />

        <!-- The badge icon is visually aligned to the square containing the conversation icon,
        but it has a border in the color of the background that is meant to delimit it from the
        conversation icon. This border, although not visible due to the color, is technically
        outside these bounds.
        In order to align the badge properly to the bottom end of the square, we use a top/start
        margin that is equal to (size of the conversation icon - size of the badge - size of the
        border on one side).
        -->
        <FrameLayout
            android:id="@+id/conversation_icon_badge"
            android:layout_width="@dimen/conversation_icon_size_badged"
            android:layout_height="@dimen/conversation_icon_size_badged"
            android:layout_gravity="end|bottom"
            android:layout_width="@dimen/notification_2025_conversation_icon_badge_size"
            android:layout_height="@dimen/notification_2025_conversation_icon_badge_size"
            android:layout_marginTop="@dimen/notification_2025_conversation_icon_badge_position"
            android:layout_marginStart="@dimen/notification_2025_conversation_icon_badge_position"
            android:clipChildren="false"
            android:clipToPadding="false"
            >
@@ -75,7 +84,7 @@
                android:id="@+id/icon"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_margin="4dp"
                android:layout_margin="@dimen/notification_2025_conversation_icon_badge_padding"
                android:layout_gravity="center"
                android:forceHasOverlappingRendering="false"
                />
+12 −0
Original line number Diff line number Diff line
@@ -941,6 +941,18 @@
    <!-- The size of the importance ring -->
    <dimen name="importance_ring_size">20dp</dimen>

    <!-- The spacing around the app icon badge shown next to the conversation icon -->
    <dimen name="notification_2025_conversation_icon_badge_padding">2dp</dimen>

    <!-- Top and start margin for the app icon badge shown next to the conversation icon, to align
        it to the bottom end corner.
        40dp (conversation icon size) - 16dp (actual size of badge) - 2dp (badge padding) -->
    <dimen name="notification_2025_conversation_icon_badge_position">22dp</dimen>

    <!-- The size of the app icon badge shown next to the conversation icon, including its padding.
        The actual size of the icon is 16dp, plus 2dp for each side for the padding. -->
    <dimen name="notification_2025_conversation_icon_badge_size">20dp</dimen>

    <!-- The top padding of the conversation icon container in the regular state-->
    <dimen name="conversation_icon_container_top_padding">20dp</dimen>

+0 −8
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import android.content.Context
import android.graphics.drawable.AnimatedImageDrawable
import android.view.View
import android.view.ViewGroup
import android.view.ViewGroup.MarginLayoutParams
import com.android.internal.widget.CachingIconView
import com.android.internal.widget.ConversationLayout
import com.android.internal.widget.MessagingGroup
@@ -94,13 +93,6 @@ class NotificationConversationTemplateViewWrapper(
        // Reinspect the notification. Before the super call, because the super call also updates
        // the transformation types and we need to have our values set by then.
        resolveViews()
        if (Flags.notificationsRedesignAppIcons() && row.isShowingAppIcon) {
            // Override the margins to be 2dp instead of 4dp according to the new design if we're
            // showing the app icon.
            val lp = badgeIconView.layoutParams as MarginLayoutParams
            lp.setMargins(2, 2, 2, 2)
            badgeIconView.layoutParams = lp
        }
        super.onContentUpdated(row)
    }