Fix snooze/bubble button padding

* Reduce the conversation expander width to 48dp.
  This matches the expander width for normal notifications.
* Remove end padding for snooze or bubble buttons.
* Use layout to ensure 12dp end padding for actions iff
  neither of the buttons is present.

Bug: 163626038
Test: manual
Change-Id: Ic780f98ad74a2e148db2716aca52abe5137fa4a1
This commit is contained in:
Jeff DeCew
2020-11-18 10:10:34 -05:00
parent 4d19b03fd5
commit 370a2ce7d7
5 changed files with 35 additions and 34 deletions

View File

@@ -28,7 +28,6 @@
android:layout_height="wrap_content"
android:gravity="end"
android:orientation="horizontal"
android:paddingEnd="@dimen/bubble_gone_padding_end"
android:background="@color/notification_action_list_background_color"
>
@@ -45,22 +44,34 @@
<!-- actions will be added here -->
</com.android.internal.widget.NotificationActionListLayout>
<ImageView
android:id="@+id/snooze_button"
android:layout_width="@dimen/notification_actions_icon_size"
android:layout_height="@dimen/notification_actions_icon_size"
android:layout_gravity="center_vertical|end"
android:visibility="gone"
android:scaleType="centerInside"
/>
<!--
This nested linear layout exists to ensure that if the neither of the contained
actions is visible we have some minimum padding at the end of the actions is present,
then there will be 12dp of padding at the end of the actions list.
-->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:minWidth="@dimen/snooze_and_bubble_gone_padding_end"
>
<ImageView
android:id="@+id/snooze_button"
android:layout_width="@dimen/notification_actions_icon_size"
android:layout_height="@dimen/notification_actions_icon_size"
android:layout_gravity="center_vertical|end"
android:visibility="gone"
android:scaleType="centerInside"
/>
<ImageView
android:id="@+id/bubble_button"
android:layout_width="@dimen/notification_actions_icon_size"
android:layout_height="@dimen/notification_actions_icon_size"
android:layout_gravity="center_vertical|end"
android:visibility="gone"
android:scaleType="centerInside"
/>
<ImageView
android:id="@+id/bubble_button"
android:layout_width="@dimen/notification_actions_icon_size"
android:layout_height="@dimen/notification_actions_icon_size"
android:layout_gravity="center_vertical|end"
android:visibility="gone"
android:scaleType="centerInside"
/>
</LinearLayout>
</LinearLayout>
</FrameLayout>

View File

@@ -327,10 +327,10 @@
android:id="@+id/expand_button_touch_container"
android:layout_width="wrap_content"
android:layout_height="@dimen/conversation_expand_button_size"
android:paddingStart="16dp"
android:paddingStart="@dimen/conversation_expand_button_side_margin"
android:orientation="horizontal"
android:layout_gravity="end|top"
android:paddingEnd="@dimen/notification_content_margin_end"
android:paddingEnd="@dimen/conversation_expand_button_side_margin"
android:clipToPadding="false"
android:clipChildren="false"
>

View File

@@ -340,11 +340,8 @@
<!-- The margin of the content to an image-->
<dimen name="notification_content_image_margin_end">8dp</dimen>
<!-- The padding at the end of actions when the bubble button is visible-->
<dimen name="bubble_visible_padding_end">3dp</dimen>
<!-- The padding at the end of actions when the bubble button is gone-->
<dimen name="bubble_gone_padding_end">12dp</dimen>
<!-- The padding at the end of actions when the snooze and bubble buttons are gone-->
<dimen name="snooze_and_bubble_gone_padding_end">12dp</dimen>
<!-- The spacing between messages in Notification.MessagingStyle -->
<dimen name="notification_messaging_spacing">6dp</dimen>
@@ -744,6 +741,9 @@
<dimen name="conversation_expand_button_size">80dp</dimen>
<!-- Top margin of the expand button for conversations when expanded -->
<dimen name="conversation_expand_button_top_margin_expanded">18dp</dimen>
<!-- Side margin of the expand button for conversations.
width of expand asset (22) + 2 * this (13) == notification_header_expand_icon_size (48) -->
<dimen name="conversation_expand_button_side_margin">13dp</dimen>
<!-- Side margins of the conversation badge in relation to the conversation icon -->
<dimen name="conversation_badge_side_margin">36dp</dimen>
<!-- size of the notification badge when applied to the conversation icon -->

View File

@@ -3560,8 +3560,6 @@
<java-symbol type="id" name="clip_children_tag" />
<java-symbol type="id" name="bubble_button" />
<java-symbol type="id" name="snooze_button" />
<java-symbol type="dimen" name="bubble_visible_padding_end" />
<java-symbol type="dimen" name="bubble_gone_padding_end" />
<java-symbol type="dimen" name="text_size_body_2_material" />
<java-symbol type="dimen" name="messaging_avatar_size" />
<java-symbol type="dimen" name="messaging_group_sending_progress_size" />

View File

@@ -1369,16 +1369,8 @@ public class NotificationContentView extends FrameLayout {
bubbleButton.setOnClickListener(mContainingNotification.getBubbleClickListener());
bubbleButton.setVisibility(VISIBLE);
actionContainer.setVisibility(VISIBLE);
int paddingEnd = getResources().getDimensionPixelSize(
com.android.internal.R.dimen.bubble_visible_padding_end);
actionContainerLayout.setPaddingRelative(0, 0, paddingEnd, 0);
} else {
bubbleButton.setVisibility(GONE);
int paddingEnd = getResources().getDimensionPixelSize(
com.android.internal.R.dimen.bubble_gone_padding_end);
actionContainerLayout.setPaddingRelative(0, 0, paddingEnd, 0);
}
}