From 61b8ed9853b0a47a65123c51ee19d1e7f9fef308 Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Mon, 26 Apr 2021 17:36:16 -0400 Subject: Correct the centering of the conversation avatars when badged Fixes: 185593456 Test: visual Change-Id: I4422c7e76cbb85f7a03bd69d53e38ef737dd80d6 --- .../internal/widget/ConversationLayout.java | 48 ++++++++++++---------- ...cation_template_conversation_icon_container.xml | 11 +++-- core/res/res/values/dimens.xml | 12 +++--- core/res/res/values/symbols.xml | 6 +-- .../res/layout/notification_conversation_info.xml | 8 ++-- 5 files changed, 49 insertions(+), 36 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" > - + @@ -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/values/dimens.xml b/core/res/res/values/dimens.xml index 6be6167fba30..538c1211edb3 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -776,8 +776,8 @@ 88dp 12dp - - 32dp + + 4dp 20dp @@ -786,10 +786,10 @@ 32dp @dimen/conversation_face_pile_avatar_size - - @dimen/conversation_badge_side_margin - - @dimen/conversation_badge_side_margin + + @dimen/conversation_badge_protrusion + + @dimen/conversation_badge_protrusion 2dp diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 3a22efce70fc..7edcde70350a 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -4080,15 +4080,15 @@ - + - - + + 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" > - + @@ -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" > -- cgit v1.2.3-59-g8ed1b From ee9189800d6c039e750f1b09e06213898d140d0e Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Mon, 19 Apr 2021 10:49:51 -0400 Subject: Small tweaks to improve messaging/conversation appearance. Bug: 185593456 Test: manual, visual Change-Id: I7275175e5baee554cace86fe9a2553d8052ac5e6 --- core/res/res/layout/notification_template_material_messaging.xml | 2 -- core/res/res/values/dimens.xml | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) 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"> diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index 538c1211edb3..639d9e7fc2eb 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -809,8 +809,8 @@ 8dp - - 38dp + + 40dp 4dp -- cgit v1.2.3-59-g8ed1b