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

Commit 7185f33d authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

Go back to using LinearLayout in old MediaStyle

I17e6a805bb74bd4ad9ee9259ff6793ba5246570d changed all the layouts to use
a FrameLayout so that we could have the text on the second line in
collapsed notifications flow below the expander.

In the case of the old MediaStyle notifications, since it's possible for
action icons to be displayed on the right side when the notification is
collapsed, it ended up overlapping. Since for this particular style, the
actions are usually more important than the text, we'll go back to the
old layout to fix the issue.

Fix: 430601743
Test: manual, screenshot tests should be unchanged
Flag: android.app.notifications_redesign_templates
Change-Id: I189ab42631fad2b91c21aa6928302b4b31be41e5
parent 0e62272f
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -6333,7 +6333,7 @@ public class Notification implements Parcelable
                // If there is no title, the text (or big_text) needs to wrap around the image
                result.mTitleMarginSet.applyToView(contentView, p.mTextViewId);
                contentView.setInt(p.mTextViewId, "setNumIndentLines", p.hasTitle() ? 0 : 1);
            } else if (notificationsRedesignTemplates() && !p.mCompact) {
            } else if (notificationsRedesignTemplates() && p.mNeedsExtraTextMargin) {
                // In the collapsed view (except for compact HUNs), the top line needs to
                // accommodate both the expander and large icon (when present)
                result.mHeadingFullMarginSet.applyToView(contentView, R.id.notification_top_line);
@@ -7191,7 +7191,7 @@ public class Notification implements Parcelable
            final StandardTemplateParams p = mParams.reset()
                    .viewType(StandardTemplateParams.VIEW_TYPE_HEADS_UP)
                    .compact(true)
                    .needsExtraTextMargin(false)
                    .fillTextsFrom(this);
            // Notification text is shown as secondary header text
            // for the minimal hun when it is provided.
@@ -8457,7 +8457,7 @@ public class Notification implements Parcelable
                // ensures that we don't under-pad the content, which could lead to abuse, at the
                // cost of making single-line custom content over-padded.
                Builder.setHeaderlessVerticalMargins(template, p, true /* hasSecondLine */);
                if (notificationsRedesignTemplates()) {
                if (notificationsRedesignTemplates() && p.mNeedsExtraTextMargin) {
                    // also update the end margin to account for the large icon or expander
                    result.mHeadingFullMarginSet.applyToView(template,
                            R.id.notification_main_column);
@@ -10926,7 +10926,8 @@ public class Notification implements Parcelable
                    .hideLeftIcon(false)                  // allow large icon on left when grouped
                    .hideRightIcon(numActionsToShow > 0)  // right icon or actions; not both
                    .hideProgress(true)
                    .fillTextsFrom(mBuilder);
                    .fillTextsFrom(mBuilder)
                    .needsExtraTextMargin(false);
            TemplateBindResult result = new TemplateBindResult();
            RemoteViews template = mBuilder.applyStandardTemplate(
                    mBuilder.getCollapsedMediaLayoutResource(), p,
@@ -16531,7 +16532,9 @@ public class Notification implements Parcelable
        int mViewType = VIEW_TYPE_UNSPECIFIED;
        boolean mHeaderless;
        boolean mCompact;
        // Whether the layout handles the end margin for the text already (to leave space for the
        // expander/large icon) or we need to set it separately.
        boolean mNeedsExtraTextMargin = true;
        boolean mHideAppName;
        boolean mHideTitle;
        boolean mHideSubText;
@@ -16557,7 +16560,7 @@ public class Notification implements Parcelable
        final StandardTemplateParams reset() {
            mViewType = VIEW_TYPE_UNSPECIFIED;
            mHeaderless = false;
            mCompact = false;
            mNeedsExtraTextMargin = true;
            mHideAppName = false;
            mHideTitle = false;
            mHideSubText = false;
@@ -16596,8 +16599,8 @@ public class Notification implements Parcelable
            return this;
        }
        public StandardTemplateParams compact(boolean compact) {
            mCompact = compact;
        public StandardTemplateParams needsExtraTextMargin(boolean needsExtraTextMargin) {
            mNeedsExtraTextMargin = needsExtraTextMargin;
            return this;
        }
+19 −11
Original line number Diff line number Diff line
@@ -60,11 +60,12 @@
        android:focusable="false"
        />

    <FrameLayout
    <LinearLayout
        android:id="@+id/notification_headerless_view_row"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginStart="@dimen/notification_2025_content_margin_start"
        android:orientation="horizontal"
        >

        <!--
@@ -73,19 +74,19 @@
        -->
        <LinearLayout
            android:id="@+id/notification_headerless_view_column"
            android:layout_width="match_parent"
            android:layout_width="0px"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_weight="1"
            android:layout_marginVertical="@dimen/notification_2025_reduced_margin"
            android:orientation="vertical"
            >

            <NotificationTopLineView
                android:id="@+id/notification_top_line"
                android:layout_width="match_parent"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/notification_2025_additional_margin"
                android:layout_marginEnd="@dimen/notification_2025_content_margin_end"
                android:minHeight="@dimen/notification_headerless_line_height"
                android:clipChildren="false"
                android:theme="@style/Theme.DeviceDefault.Notification"
@@ -123,7 +124,6 @@
                <com.android.internal.widget.NotificationVanishingFrameLayout
                    android:layout_width="match_parent"
                    android:layout_marginBottom="@dimen/notification_2025_additional_margin"
                    android:layout_marginEnd="@dimen/notification_2025_margin"
                    android:layout_height="@dimen/notification_headerless_line_height"
                    >
                    <include layout="@layout/notification_2025_text" />
@@ -133,21 +133,30 @@
                    layout="@layout/notification_template_progress"
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/notification_headerless_line_height"
                    android:layout_marginEnd="@dimen/notification_2025_margin"
                    />

            </LinearLayout>

        </LinearLayout>

        <include layout="@layout/notification_2025_right_icon" />
        <ImageView
            android:id="@+id/right_icon"
            android:layout_width="@dimen/notification_right_icon_size"
            android:layout_height="@dimen/notification_right_icon_size"
            android:layout_gravity="center_vertical|end"
            android:layout_marginVertical="@dimen/notification_2025_right_icon_vertical_margin"
            android:layout_marginStart="@dimen/notification_2025_right_icon_content_margin"
            android:background="@drawable/notification_large_icon_outline"
            android:clipToOutline="true"
            android:importantForAccessibility="no"
            android:scaleType="centerCrop"
            />

        <LinearLayout
            android:id="@+id/media_actions"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical|end"
            android:layout_marginEnd="@dimen/notification_2025_content_margin_end"
            android:layout_gravity="center_vertical"
            android:layoutDirection="ltr"
            android:orientation="horizontal"
            >
@@ -170,7 +179,6 @@
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:minWidth="@dimen/notification_2025_margin"
            android:layout_gravity="top|end"
            >

            <include layout="@layout/notification_2025_expand_button"
@@ -181,7 +189,7 @@

        </FrameLayout>

    </FrameLayout>
    </LinearLayout>

    <include layout="@layout/notification_close_button"
        android:id="@+id/close_button"