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

Commit 113979e4 authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

[Notif redesign] Allow collapsed custom views to take up to 48dp

Normally collapsed notification content has a height of 40dp, with a
margin of 16dp above and below (so the standard height for collapsed
notifications is 72dp in the redesign). However, custom views have
previously been allowed to have a height of up to 48dp when collapsed,
so the new design was causing them to get cut off.

In order to fix this issue without directly making custom view
notifications taller, we can reduce the margin to 12dp (while applying
the additional 4dp to the child views, for the non-custom-view case).

Test: manual for custom views, plus screenshot tests should be unchanged
Flag: android.app.notifications_redesign_templates
Bug: 378660052
Fix: 386397001
Change-Id: I89a2c82c8f4b022d2bb8a50483cdf6c5c4aac2a3
parent 1c72035d
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -66,14 +66,17 @@
        android:orientation="horizontal"
        >

        <!--
        We use a smaller vertical margin than usual, to allow the content of custom views to
        grow up to 48dp height when needed in collapsed notifications.
        -->
        <LinearLayout
            android:id="@+id/notification_headerless_view_column"
            android:layout_width="0px"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_weight="1"
            android:layout_marginBottom="@dimen/notification_2025_margin"
            android:layout_marginTop="@dimen/notification_2025_margin"
            android:layout_marginVertical="@dimen/notification_2025_reduced_margin"
            android:orientation="vertical"
            >

@@ -81,6 +84,7 @@
                android:id="@+id/notification_top_line"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/notification_2025_additional_margin"
                android:minHeight="@dimen/notification_2025_content_min_height"
                android:clipChildren="false"
                android:theme="@style/Theme.DeviceDefault.Notification"
@@ -118,6 +122,7 @@
                <com.android.internal.widget.NotificationVanishingFrameLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="@dimen/notification_2025_additional_margin"
                    android:minHeight="@dimen/notification_headerless_line_height"
                    >
                    <!-- This is the simplest way to keep this text vertically centered without
+7 −2
Original line number Diff line number Diff line
@@ -68,14 +68,17 @@
        android:orientation="horizontal"
        >

        <!--
        We use a smaller vertical margin than usual, to allow the content of custom views to
        grow up to 48dp height when needed in collapsed notifications.
        -->
        <LinearLayout
            android:id="@+id/notification_headerless_view_column"
            android:layout_width="0px"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_weight="1"
            android:layout_marginBottom="@dimen/notification_2025_margin"
            android:layout_marginTop="@dimen/notification_2025_margin"
            android:layout_marginVertical="@dimen/notification_2025_reduced_margin"
            android:orientation="vertical"
            >

@@ -83,6 +86,7 @@
                android:id="@+id/notification_top_line"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/notification_2025_additional_margin"
                android:minHeight="@dimen/notification_headerless_line_height"
                android:clipChildren="false"
                android:theme="@style/Theme.DeviceDefault.Notification"
@@ -119,6 +123,7 @@

                <com.android.internal.widget.NotificationVanishingFrameLayout
                    android:layout_width="match_parent"
                    android:layout_marginBottom="@dimen/notification_2025_additional_margin"
                    android:layout_height="@dimen/notification_headerless_line_height"
                    >
                    <!-- This is the simplest way to keep this text vertically centered without
+7 −1
Original line number Diff line number Diff line
@@ -420,6 +420,12 @@
    <!-- Margin for all notification content -->
    <dimen name="notification_2025_margin">16dp</dimen>

    <!-- A smaller version of the margin to be used when we need more space for the content -->
    <dimen name="notification_2025_reduced_margin">12dp</dimen>

    <!-- The difference between the usual margin and the reduced margin -->
    <dimen name="notification_2025_additional_margin">4dp</dimen>

    <!-- Vertical margin for the headerless notification content, when content has 1 line -->
    <!-- 16 * 2 (margins) + 24 (1 line) = 56 (notification) -->
    <dimen name="notification_headerless_margin_oneline">16dp</dimen>
@@ -438,7 +444,7 @@
    <dimen name="notification_collapsed_height_with_summarization">156dp</dimen>

    <!-- Max height of a collapsed (headerless) notification with one or two lines -->
    <!-- 16 * 2 (margins) + 48 (min content height) = 72 (notification) -->
    <!-- 14 * 2 (reduced margins) + 48 (max collapsed content height) = 72 (notification) -->
    <dimen name="notification_2025_min_height">72dp</dimen>

    <!-- Height of a headerless notification with one line -->