diff options
| author | 2021-05-07 15:30:34 +0000 | |
|---|---|---|
| committer | 2021-05-07 15:30:34 +0000 | |
| commit | 21e2de2d4cfa028f0c684c9650ba04bbda632372 (patch) | |
| tree | 9c9cbc781f7e890c8e524c93940077a42faaf9a3 | |
| parent | 737d377727ec5616eec61b30308eeaa33b082f2f (diff) | |
| parent | ee9189800d6c039e750f1b09e06213898d140d0e (diff) | |
Merge changes I7275175e,I4422c7e7 into sc-dev
* changes:
Small tweaks to improve messaging/conversation appearance.
Correct the centering of the conversation avatars when badged
6 files changed, 51 insertions, 40 deletions
diff --git a/core/java/com/android/internal/widget/ConversationLayout.java b/core/java/com/android/internal/widget/ConversationLayout.java index 4e96ae7f7903..2c92b91035d7 100644 --- a/core/java/com/android/internal/widget/ConversationLayout.java +++ b/core/java/com/android/internal/widget/ConversationLayout.java @@ -116,13 +116,13 @@ public class ConversationLayout extends FrameLayout private ViewGroup mExpandButtonAndContentContainer; private NotificationExpandButton mExpandButton; private MessagingLinearLayout mImageMessageContainer; - private int mBadgedSideMargins; + private int mBadgeProtrusion; private int mConversationAvatarSize; private int mConversationAvatarSizeExpanded; private CachingIconView mIcon; private CachingIconView mImportanceRingView; - private int mExpandedGroupSideMargin; - private int mExpandedGroupSideMarginFacePile; + private int mExpandedGroupBadgeProtrusion; + private int mExpandedGroupBadgeProtrusionFacePile; private View mConversationFacePile; private int mNotificationBackgroundColor; private CharSequence mFallbackChatName; @@ -251,8 +251,8 @@ public class ConversationLayout extends FrameLayout R.dimen.conversation_header_expanded_padding_end); mContentMarginEnd = getResources().getDimensionPixelSize( R.dimen.notification_content_margin_end); - mBadgedSideMargins = getResources().getDimensionPixelSize( - R.dimen.conversation_badge_side_margin); + mBadgeProtrusion = getResources().getDimensionPixelSize( + R.dimen.conversation_badge_protrusion); mConversationAvatarSize = getResources().getDimensionPixelSize( R.dimen.conversation_avatar_size); mConversationAvatarSizeExpanded = getResources().getDimensionPixelSize( @@ -263,10 +263,10 @@ public class ConversationLayout extends FrameLayout R.dimen.conversation_icon_container_top_padding); mExpandedGroupMessagePadding = getResources().getDimensionPixelSize( R.dimen.expanded_group_conversation_message_padding); - mExpandedGroupSideMargin = getResources().getDimensionPixelSize( - R.dimen.conversation_badge_side_margin_group_expanded); - mExpandedGroupSideMarginFacePile = getResources().getDimensionPixelSize( - R.dimen.conversation_badge_side_margin_group_expanded_face_pile); + mExpandedGroupBadgeProtrusion = getResources().getDimensionPixelSize( + R.dimen.conversation_badge_protrusion_group_expanded); + mExpandedGroupBadgeProtrusionFacePile = getResources().getDimensionPixelSize( + R.dimen.conversation_badge_protrusion_group_expanded_face_pile); mConversationFacePile = findViewById(R.id.conversation_face_pile); mFacePileAvatarSize = getResources().getDimensionPixelSize( R.dimen.conversation_face_pile_avatar_size); @@ -646,7 +646,7 @@ public class ConversationLayout extends FrameLayout facepileAvatarSize = mFacePileAvatarSizeExpandedGroup; facePileBackgroundSize = facepileAvatarSize + 2 * mFacePileProtectionWidthExpanded; } - LayoutParams layoutParams = (LayoutParams) mConversationIconView.getLayoutParams(); + LayoutParams layoutParams = (LayoutParams) mConversationFacePile.getLayoutParams(); layoutParams.width = conversationAvatarSize; layoutParams.height = conversationAvatarSize; mConversationFacePile.setLayoutParams(layoutParams); @@ -679,29 +679,35 @@ public class ConversationLayout extends FrameLayout * update the icon position and sizing */ private void updateIconPositionAndSize() { - int sidemargin; + int badgeProtrusion; int conversationAvatarSize; if (mIsOneToOne || mIsCollapsed) { - sidemargin = mBadgedSideMargins; + badgeProtrusion = mBadgeProtrusion; conversationAvatarSize = mConversationAvatarSize; } else { - sidemargin = mConversationFacePile.getVisibility() == VISIBLE - ? mExpandedGroupSideMarginFacePile - : mExpandedGroupSideMargin; + badgeProtrusion = mConversationFacePile.getVisibility() == VISIBLE + ? mExpandedGroupBadgeProtrusionFacePile + : mExpandedGroupBadgeProtrusion; conversationAvatarSize = mConversationAvatarSizeExpanded; } - LayoutParams layoutParams = - (LayoutParams) mConversationIconBadge.getLayoutParams(); - layoutParams.topMargin = sidemargin; - layoutParams.setMarginStart(sidemargin); - mConversationIconBadge.setLayoutParams(layoutParams); if (mConversationIconView.getVisibility() == VISIBLE) { - layoutParams = (LayoutParams) mConversationIconView.getLayoutParams(); + LayoutParams layoutParams = (LayoutParams) mConversationIconView.getLayoutParams(); layoutParams.width = conversationAvatarSize; layoutParams.height = conversationAvatarSize; + layoutParams.leftMargin = badgeProtrusion; + layoutParams.rightMargin = badgeProtrusion; + layoutParams.bottomMargin = badgeProtrusion; mConversationIconView.setLayoutParams(layoutParams); } + + if (mConversationFacePile.getVisibility() == VISIBLE) { + LayoutParams layoutParams = (LayoutParams) mConversationFacePile.getLayoutParams(); + layoutParams.leftMargin = badgeProtrusion; + layoutParams.rightMargin = badgeProtrusion; + layoutParams.bottomMargin = badgeProtrusion; + mConversationFacePile.setLayoutParams(layoutParams); + } } private void updatePaddingsBasedOnContentAvailability() { diff --git a/core/res/res/layout/notification_template_conversation_icon_container.xml b/core/res/res/layout/notification_template_conversation_icon_container.xml index a88ff0d104a6..0438dc5b5c81 100644 --- a/core/res/res/layout/notification_template_conversation_icon_container.xml +++ b/core/res/res/layout/notification_template_conversation_icon_container.xml @@ -36,11 +36,14 @@ android:layout_gravity="top|center_horizontal" > - <!-- Big icon: 52x52, 12dp padding left + top, 16dp padding right --> + <!-- Big icon: 48x48, 12dp padding top, 16dp padding sides --> <com.android.internal.widget.CachingIconView android:id="@+id/conversation_icon" android:layout_width="@dimen/conversation_avatar_size" android:layout_height="@dimen/conversation_avatar_size" + android:layout_marginLeft="@dimen/conversation_badge_protrusion" + android:layout_marginRight="@dimen/conversation_badge_protrusion" + android:layout_marginBottom="@dimen/conversation_badge_protrusion" android:scaleType="centerCrop" android:importantForAccessibility="no" /> @@ -49,6 +52,9 @@ android:layout="@layout/conversation_face_pile_layout" android:layout_width="@dimen/conversation_avatar_size" android:layout_height="@dimen/conversation_avatar_size" + android:layout_marginLeft="@dimen/conversation_badge_protrusion" + android:layout_marginRight="@dimen/conversation_badge_protrusion" + android:layout_marginBottom="@dimen/conversation_badge_protrusion" android:id="@+id/conversation_face_pile" /> @@ -56,8 +62,7 @@ android:id="@+id/conversation_icon_badge" android:layout_width="@dimen/conversation_icon_size_badged" android:layout_height="@dimen/conversation_icon_size_badged" - android:layout_marginLeft="@dimen/conversation_badge_side_margin" - android:layout_marginTop="@dimen/conversation_badge_side_margin" + android:layout_gravity="end|bottom" android:clipChildren="false" android:clipToPadding="false" > diff --git a/core/res/res/layout/notification_template_material_messaging.xml b/core/res/res/layout/notification_template_material_messaging.xml index 3564f9755a5d..eb61ea45b4df 100644 --- a/core/res/res/layout/notification_template_material_messaging.xml +++ b/core/res/res/layout/notification_template_material_messaging.xml @@ -199,13 +199,11 @@ android:id="@+id/notification_action_list_margin_target" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="-20dp" android:clipChildren="false" android:orientation="vertical"> <include layout="@layout/notification_template_smart_reply_container" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/notification_content_margin" android:layout_marginStart="@dimen/notification_content_margin_start" android:layout_marginEnd="@dimen/notification_content_margin_end" /> <include layout="@layout/notification_material_action_list" /> diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index ade8516a48e9..4f90a174fef7 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -776,8 +776,8 @@ <dimen name="conversation_expand_button_height">88dp</dimen> <!-- this is the margin between the Conversation image and the content --> <dimen name="conversation_image_start_margin">12dp</dimen> - <!-- Side margins of the conversation badge in relation to the conversation icon --> - <dimen name="conversation_badge_side_margin">32dp</dimen> + <!-- amount the badge sticks out from the conversation avatar --> + <dimen name="conversation_badge_protrusion">4dp</dimen> <!-- size of the notification badge when applied to the conversation icon --> <dimen name="conversation_icon_size_badged">20dp</dimen> <!-- size of the conversation avatar in an expanded group --> @@ -786,10 +786,10 @@ <dimen name="conversation_face_pile_avatar_size">32dp</dimen> <!-- size of the face pile icons when the group is expanded --> <dimen name="conversation_face_pile_avatar_size_group_expanded">@dimen/conversation_face_pile_avatar_size</dimen> - <!-- Side margins of the conversation badge in relation to the conversation icon when the group is expanded--> - <dimen name="conversation_badge_side_margin_group_expanded">@dimen/conversation_badge_side_margin</dimen> - <!-- Side margins of the conversation badge in relation to the conversation icon when the group is expanded--> - <dimen name="conversation_badge_side_margin_group_expanded_face_pile">@dimen/conversation_badge_side_margin</dimen> + <!-- amount the badge sticks out from the conversation avatar when the group is expanded --> + <dimen name="conversation_badge_protrusion_group_expanded">@dimen/conversation_badge_protrusion</dimen> + <!-- amount the badge sticks out from the conversation face pile when the group is expanded --> + <dimen name="conversation_badge_protrusion_group_expanded_face_pile">@dimen/conversation_badge_protrusion</dimen> <!-- The width of the protection of the face pile layout--> <dimen name="conversation_face_pile_protection_width">2dp</dimen> <!-- The width of the protection of the face pile layout when expanded--> @@ -809,8 +809,8 @@ <!-- The top padding of the conversation icon container when the avatar is small--> <dimen name="conversation_icon_container_top_padding_small_avatar">8dp</dimen> - <!-- The padding of the conversation header when expanded. This is calculated from the expand button size + notification_content_margin_end --> - <dimen name="conversation_header_expanded_padding_end">38dp</dimen> + <!-- The padding of the conversation header when expanded. This is calculated from the expand button size (56dp) - notification_content_margin_end (16dp) --> + <dimen name="conversation_header_expanded_padding_end">40dp</dimen> <!-- extra padding at the start of the icons when not conversations to keep them horizontally aligned with the notification icon --> <dimen name="messaging_layout_icon_padding_start">4dp</dimen> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index b8f82b411969..d8620a706fe2 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -4084,15 +4084,15 @@ <java-symbol type="id" name="conversation_image_message_container" /> <java-symbol type="id" name="conversation_icon_container" /> <java-symbol type="dimen" name="messaging_group_singleline_sender_padding_end" /> - <java-symbol type="dimen" name="conversation_badge_side_margin" /> + <java-symbol type="dimen" name="conversation_badge_protrusion" /> <java-symbol type="dimen" name="conversation_avatar_size" /> <java-symbol type="dimen" name="conversation_avatar_size_group_expanded" /> <java-symbol type="dimen" name="conversation_face_pile_avatar_size" /> <java-symbol type="dimen" name="conversation_face_pile_avatar_size_group_expanded" /> <java-symbol type="dimen" name="conversation_face_pile_protection_width" /> <java-symbol type="dimen" name="conversation_face_pile_protection_width_expanded" /> - <java-symbol type="dimen" name="conversation_badge_side_margin_group_expanded" /> - <java-symbol type="dimen" name="conversation_badge_side_margin_group_expanded_face_pile" /> + <java-symbol type="dimen" name="conversation_badge_protrusion_group_expanded" /> + <java-symbol type="dimen" name="conversation_badge_protrusion_group_expanded_face_pile" /> <java-symbol type="dimen" name="conversation_content_start" /> <java-symbol type="dimen" name="expanded_group_conversation_message_padding" /> <java-symbol type="dimen" name="messaging_layout_icon_padding_start" /> diff --git a/packages/SystemUI/res/layout/notification_conversation_info.xml b/packages/SystemUI/res/layout/notification_conversation_info.xml index c332f4cf7a39..2ec4e73145f5 100644 --- a/packages/SystemUI/res/layout/notification_conversation_info.xml +++ b/packages/SystemUI/res/layout/notification_conversation_info.xml @@ -45,11 +45,14 @@ android:layout_marginEnd="12dp" > - <!-- Big icon: 52x52, 12dp padding left + top, 16dp padding right --> + <!-- Big icon: 48x48, 12dp padding top, 16dp padding sides --> <ImageView android:id="@+id/conversation_icon" android:layout_width="@*android:dimen/conversation_avatar_size" android:layout_height="@*android:dimen/conversation_avatar_size" + android:layout_marginLeft="@*android:dimen/conversation_badge_protrusion" + android:layout_marginRight="@*android:dimen/conversation_badge_protrusion" + android:layout_marginBottom="@*android:dimen/conversation_badge_protrusion" android:scaleType="centerCrop" android:importantForAccessibility="no" /> @@ -58,8 +61,7 @@ android:id="@+id/conversation_icon_badge" android:layout_width="@*android:dimen/conversation_icon_size_badged" android:layout_height="@*android:dimen/conversation_icon_size_badged" - android:layout_marginLeft="@*android:dimen/conversation_badge_side_margin" - android:layout_marginTop="@*android:dimen/conversation_badge_side_margin" + android:layout_gravity="end|bottom" android:clipChildren="false" android:clipToPadding="false" > |