Merge "Fix vertical height of emphasized action buttons" into udc-dev

This commit is contained in:
Jeff DeCew
2023-04-26 11:31:16 +00:00
committed by Android (Google) Code Review
2 changed files with 15 additions and 18 deletions

View File

@@ -50,6 +50,8 @@ public class NotificationActionListLayout extends LinearLayout {
private boolean mEmphasizedMode; private boolean mEmphasizedMode;
private int mDefaultPaddingBottom; private int mDefaultPaddingBottom;
private int mDefaultPaddingTop; private int mDefaultPaddingTop;
private int mEmphasizedPaddingTop;
private int mEmphasizedPaddingBottom;
private int mEmphasizedHeight; private int mEmphasizedHeight;
private int mRegularHeight; private int mRegularHeight;
@DimenRes private int mCollapsibleIndentDimen = R.dimen.notification_actions_padding_start; @DimenRes private int mCollapsibleIndentDimen = R.dimen.notification_actions_padding_start;
@@ -322,13 +324,16 @@ public class NotificationActionListLayout extends LinearLayout {
} }
private void updateHeights() { private void updateHeights() {
int paddingTop = getResources().getDimensionPixelSize( int inset = getResources().getDimensionPixelSize(
com.android.internal.R.dimen.notification_content_margin); com.android.internal.R.dimen.button_inset_vertical_material);
mEmphasizedPaddingTop = getResources().getDimensionPixelSize(
com.android.internal.R.dimen.notification_content_margin) - inset;
// same padding on bottom and at end // same padding on bottom and at end
int paddingBottom = getResources().getDimensionPixelSize( mEmphasizedPaddingBottom = getResources().getDimensionPixelSize(
com.android.internal.R.dimen.notification_content_margin_end); com.android.internal.R.dimen.notification_content_margin_end) - inset;
mEmphasizedHeight = paddingBottom + paddingTop + getResources().getDimensionPixelSize( mEmphasizedHeight = mEmphasizedPaddingTop + mEmphasizedPaddingBottom
com.android.internal.R.dimen.notification_action_emphasized_height); + getResources().getDimensionPixelSize(
com.android.internal.R.dimen.notification_action_emphasized_height);
mRegularHeight = getResources().getDimensionPixelSize( mRegularHeight = getResources().getDimensionPixelSize(
com.android.internal.R.dimen.notification_action_list_height); com.android.internal.R.dimen.notification_action_list_height);
} }
@@ -356,18 +361,10 @@ public class NotificationActionListLayout extends LinearLayout {
mEmphasizedMode = emphasizedMode; mEmphasizedMode = emphasizedMode;
int height; int height;
if (emphasizedMode) { if (emphasizedMode) {
int paddingTop = getResources().getDimensionPixelSize(
com.android.internal.R.dimen.notification_content_margin);
// same padding on bottom and at end
int paddingBottom = getResources().getDimensionPixelSize(
com.android.internal.R.dimen.notification_content_margin_end);
int buttonPaddingInternal = getResources().getDimensionPixelSize(
com.android.internal.R.dimen.button_inset_vertical_material);
setPaddingRelative(getPaddingStart(), setPaddingRelative(getPaddingStart(),
paddingTop - buttonPaddingInternal, mEmphasizedPaddingTop,
getPaddingEnd(), getPaddingEnd(),
paddingBottom - buttonPaddingInternal); mEmphasizedPaddingBottom);
setMinimumHeight(mEmphasizedHeight); setMinimumHeight(mEmphasizedHeight);
height = ViewGroup.LayoutParams.WRAP_CONTENT; height = ViewGroup.LayoutParams.WRAP_CONTENT;
} else { } else {

View File

@@ -257,8 +257,8 @@
<!-- The margin of the notification action list at the top --> <!-- The margin of the notification action list at the top -->
<dimen name="notification_action_list_margin_top">0dp</dimen> <dimen name="notification_action_list_margin_top">0dp</dimen>
<!-- The visual height of the emphasized notification action --> <!-- The overall height of the emphasized notification action -->
<dimen name="notification_action_emphasized_height">36dp</dimen> <dimen name="notification_action_emphasized_height">48dp</dimen>
<!-- The padding of the actions in non-conversation layout. For conversations, the analogous <!-- The padding of the actions in non-conversation layout. For conversations, the analogous
value is calculated in ConversationLayout#updateActionListPadding() --> value is calculated in ConversationLayout#updateActionListPadding() -->