Fix DecoratedCustomViewStyle

* Fix HUN state's end margins
* Restore previous max height of collapsed state
* Restore previous behavior of hiding the progress
  bar if content is greater than ~25dp
* Remove min height which isn't necessary now that
  the largeIcon has moved up a line.
* Fix headerless title's padding with the separator.

Bug: 163626038
Test: manual
Change-Id: I1fa1efa76192f081ac801a732812eef7f5bfa536
This commit is contained in:
Jeff DeCew
2020-11-16 19:15:56 -05:00
parent bcbda6967f
commit f4b91ee076
10 changed files with 43 additions and 39 deletions

View File

@@ -91672,7 +91672,6 @@ Lcom/android/internal/R$dimen;->notification_media_image_max_height_low_ram:I
Lcom/android/internal/R$dimen;->notification_media_image_max_width:I
Lcom/android/internal/R$dimen;->notification_media_image_max_width_low_ram:I
Lcom/android/internal/R$dimen;->notification_messaging_spacing:I
Lcom/android/internal/R$dimen;->notification_min_content_height:I
Lcom/android/internal/R$dimen;->notification_reply_inset:I
Lcom/android/internal/R$dimen;->notification_right_icon_size:I
Lcom/android/internal/R$dimen;->notification_right_icon_size_low_ram:I

View File

@@ -4922,8 +4922,6 @@ public class Notification implements Parcelable
contentView.setViewVisibility(textId, View.VISIBLE);
}
setContentMinHeight(contentView, showProgress || mN.hasLargeIcon());
return contentView;
}
@@ -5081,21 +5079,6 @@ public class Notification implements Parcelable
}
}
/**
* @param remoteView the remote view to update the minheight in
* @param hasMinHeight does it have a mimHeight
* @hide
*/
void setContentMinHeight(RemoteViews remoteView, boolean hasMinHeight) {
int minHeight = 0;
if (hasMinHeight) {
// we need to set the minHeight of the notification
minHeight = mContext.getResources().getDimensionPixelSize(
com.android.internal.R.dimen.notification_min_content_height);
}
remoteView.setInt(R.id.notification_main_column, "setMinimumHeight", minHeight);
}
private boolean handleProgressBar(RemoteViews contentView, Bundle ex,
StandardTemplateParams p) {
final int max = ex.getInt(EXTRA_PROGRESS_MAX, 0);
@@ -6942,7 +6925,6 @@ public class Notification implements Parcelable
mBuilder.setTextViewColorSecondary(contentView, R.id.text, p);
contentView.setViewVisibility(R.id.text, View.VISIBLE);
}
mBuilder.setContentMinHeight(contentView, mBuilder.mN.hasLargeIcon());
if (mBigLargeIconSet) {
mBuilder.mN.mLargeIcon = oldLargeIcon;
@@ -8710,7 +8692,7 @@ public class Notification implements Parcelable
RemoteViews remoteViews = mBuilder.applyStandardTemplateWithActions(
mBuilder.getHeadsUpBaseLayoutResource(),
StandardTemplateParams.VIEW_TYPE_HEADS_UP, result);
buildIntoRemoteViewContent(remoteViews, headsUpContentView, result, false);
buildIntoRemoteViewContent(remoteViews, headsUpContentView, result, true);
return remoteViews;
}
@@ -8755,8 +8737,7 @@ public class Notification implements Parcelable
Resources resources = mBuilder.mContext.getResources();
int endMargin = resources.getDimensionPixelSize(
R.dimen.notification_content_margin_end) + result.getTitleMarginEnd();
remoteViews.setViewLayoutMarginEnd(R.id.notification_main_column,
endMargin);
remoteViews.setViewLayoutMarginEnd(R.id.notification_main_column, endMargin);
}
}

View File

@@ -33,16 +33,30 @@
android:padding="@dimen/notification_icon_circle_padding"
/>
<com.android.internal.widget.RemeasuringLinearLayout
<LinearLayout
android:id="@+id/notification_standard_view_column"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="@dimen/notification_headerless_margin_vertical"
android:layout_marginTop="@dimen/notification_headerless_margin_vertical"
android:layout_marginBottom="@dimen/notification_headerless_margin_minimum"
android:layout_marginTop="@dimen/notification_headerless_margin_minimum"
android:orientation="vertical"
>
<!--
This invisible FrameLayout is here as a collapsible padding. Having a layout_weight=1 is
what causes this view (and it's counterpart at the opposite end) to collapse before the
actual content views do.
This pair of 10dp collapsible paddings (plus the 16dp fixed margins) allow us to support
headerless notifications of 1-3 lines (where each line is 20dp tall) where the 1-line
variant is 56dp and the 2- and 3-line variants are both 76dp.
-->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="@dimen/notification_headerless_margin_extra"
android:layout_weight="1"
/>
<!-- extends ViewGroup -->
<NotificationTopLineView
android:id="@+id/notification_top_line"
@@ -58,6 +72,7 @@
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/notification_header_separating_margin"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
@@ -69,7 +84,7 @@
</NotificationTopLineView>
<com.android.internal.widget.RemeasuringLinearLayout
<LinearLayout
android:id="@+id/notification_main_column"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -91,8 +106,23 @@
android:layout_height="@dimen/notification_headerless_line_height"
/>
</com.android.internal.widget.RemeasuringLinearLayout>
</com.android.internal.widget.RemeasuringLinearLayout>
</LinearLayout>
<!--
This invisible FrameLayout is here as a collapsible padding. Having a layout_weight=1 is
what causes this view (and it's counterpart at the opposite end) to collapse before the
actual content views do.
This pair of 10dp collapsible paddings (plus the 16dp fixed margins) allow us to support
headerless notifications of 1-3 lines (where each line is 20dp tall) where the 1-line
variant is 56dp and the 2- and 3-line variants are both 76dp.
-->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="@dimen/notification_headerless_margin_extra"
android:layout_weight="1"
/>
</LinearLayout>
<ImageView
android:id="@+id/right_icon"

View File

@@ -54,7 +54,6 @@
android:layout_marginStart="@dimen/notification_content_margin_start"
android:layout_marginBottom="@dimen/notification_content_margin"
android:layout_marginEnd="@dimen/notification_content_margin_end"
android:minHeight="@dimen/notification_min_content_height"
android:orientation="vertical"
>

View File

@@ -48,7 +48,6 @@
android:paddingStart="@dimen/notification_content_margin_start"
android:paddingEnd="@dimen/notification_content_margin_end"
android:clipToPadding="false"
android:minHeight="@dimen/notification_min_content_height"
android:orientation="vertical"
android:layout_weight="1"
>

View File

@@ -39,7 +39,6 @@
android:layout_gravity="top"
android:paddingStart="@dimen/notification_content_margin_start"
android:paddingEnd="@dimen/notification_content_margin_end"
android:minHeight="@dimen/notification_min_content_height"
android:layout_weight="1"
android:clipToPadding="false"
android:orientation="vertical"

View File

@@ -55,7 +55,6 @@
android:layout_height="wrap_content"
android:layout_gravity="fill_vertical"
android:layout_weight="1"
android:minHeight="@dimen/notification_min_content_height"
android:paddingBottom="@dimen/notification_content_margin"
android:orientation="vertical"
>

View File

@@ -40,7 +40,6 @@
android:layout_weight="1"
android:layout_marginStart="@dimen/notification_content_margin_start"
android:layout_marginEnd="@dimen/notification_content_margin_end"
android:minHeight="@dimen/notification_min_content_height"
android:orientation="vertical"
>
<com.android.internal.widget.MessagingLinearLayout

View File

@@ -298,8 +298,11 @@
<!-- The top padding for the notification expand button. -->
<dimen name="notification_expand_button_padding_top">1dp</dimen>
<!-- vertical margin for the headerless notification content -->
<dimen name="notification_headerless_margin_vertical">18dp</dimen>
<!-- minimum vertical margin for the headerless notification content -->
<dimen name="notification_headerless_margin_minimum">8dp</dimen>
<!-- extra vertical margin for the headerless notification content -->
<dimen name="notification_headerless_margin_extra">10dp</dimen>
<!-- The height of each of the 1 or 2 lines in the headerless notification template -->
<dimen name="notification_headerless_line_height">20sp</dimen>
@@ -319,9 +322,6 @@
<!-- The minimum width of the app name in the header if it shrinks -->
<dimen name="notification_header_shrink_min_width">72dp</dimen>
<!-- The minimum height of the content if there are at least two lines or a picture-->
<dimen name="notification_min_content_height">39dp</dimen>
<!-- The size of the media actions in the media notification. -->
<dimen name="media_notification_action_button_size">48dp</dimen>

View File

@@ -2871,7 +2871,6 @@
<java-symbol type="drawable" name="ic_collapse_notification" />
<java-symbol type="drawable" name="ic_expand_bundle" />
<java-symbol type="drawable" name="ic_collapse_bundle" />
<java-symbol type="dimen" name="notification_min_content_height" />
<java-symbol type="dimen" name="notification_header_shrink_min_width" />
<java-symbol type="dimen" name="notification_content_margin_start" />
<java-symbol type="dimen" name="notification_content_margin_end" />