Merge changes I7275175e,I4422c7e7 into sc-dev

* changes:
  Small tweaks to improve messaging/conversation appearance.
  Correct the centering of the conversation avatars when badged
This commit is contained in:
Jeff DeCew
2021-05-07 15:30:34 +00:00
committed by Android (Google) Code Review
6 changed files with 51 additions and 40 deletions

View File

@@ -116,13 +116,13 @@ public class ConversationLayout extends FrameLayout
private ViewGroup mExpandButtonAndContentContainer; private ViewGroup mExpandButtonAndContentContainer;
private NotificationExpandButton mExpandButton; private NotificationExpandButton mExpandButton;
private MessagingLinearLayout mImageMessageContainer; private MessagingLinearLayout mImageMessageContainer;
private int mBadgedSideMargins; private int mBadgeProtrusion;
private int mConversationAvatarSize; private int mConversationAvatarSize;
private int mConversationAvatarSizeExpanded; private int mConversationAvatarSizeExpanded;
private CachingIconView mIcon; private CachingIconView mIcon;
private CachingIconView mImportanceRingView; private CachingIconView mImportanceRingView;
private int mExpandedGroupSideMargin; private int mExpandedGroupBadgeProtrusion;
private int mExpandedGroupSideMarginFacePile; private int mExpandedGroupBadgeProtrusionFacePile;
private View mConversationFacePile; private View mConversationFacePile;
private int mNotificationBackgroundColor; private int mNotificationBackgroundColor;
private CharSequence mFallbackChatName; private CharSequence mFallbackChatName;
@@ -251,8 +251,8 @@ public class ConversationLayout extends FrameLayout
R.dimen.conversation_header_expanded_padding_end); R.dimen.conversation_header_expanded_padding_end);
mContentMarginEnd = getResources().getDimensionPixelSize( mContentMarginEnd = getResources().getDimensionPixelSize(
R.dimen.notification_content_margin_end); R.dimen.notification_content_margin_end);
mBadgedSideMargins = getResources().getDimensionPixelSize( mBadgeProtrusion = getResources().getDimensionPixelSize(
R.dimen.conversation_badge_side_margin); R.dimen.conversation_badge_protrusion);
mConversationAvatarSize = getResources().getDimensionPixelSize( mConversationAvatarSize = getResources().getDimensionPixelSize(
R.dimen.conversation_avatar_size); R.dimen.conversation_avatar_size);
mConversationAvatarSizeExpanded = getResources().getDimensionPixelSize( mConversationAvatarSizeExpanded = getResources().getDimensionPixelSize(
@@ -263,10 +263,10 @@ public class ConversationLayout extends FrameLayout
R.dimen.conversation_icon_container_top_padding); R.dimen.conversation_icon_container_top_padding);
mExpandedGroupMessagePadding = getResources().getDimensionPixelSize( mExpandedGroupMessagePadding = getResources().getDimensionPixelSize(
R.dimen.expanded_group_conversation_message_padding); R.dimen.expanded_group_conversation_message_padding);
mExpandedGroupSideMargin = getResources().getDimensionPixelSize( mExpandedGroupBadgeProtrusion = getResources().getDimensionPixelSize(
R.dimen.conversation_badge_side_margin_group_expanded); R.dimen.conversation_badge_protrusion_group_expanded);
mExpandedGroupSideMarginFacePile = getResources().getDimensionPixelSize( mExpandedGroupBadgeProtrusionFacePile = getResources().getDimensionPixelSize(
R.dimen.conversation_badge_side_margin_group_expanded_face_pile); R.dimen.conversation_badge_protrusion_group_expanded_face_pile);
mConversationFacePile = findViewById(R.id.conversation_face_pile); mConversationFacePile = findViewById(R.id.conversation_face_pile);
mFacePileAvatarSize = getResources().getDimensionPixelSize( mFacePileAvatarSize = getResources().getDimensionPixelSize(
R.dimen.conversation_face_pile_avatar_size); R.dimen.conversation_face_pile_avatar_size);
@@ -646,7 +646,7 @@ public class ConversationLayout extends FrameLayout
facepileAvatarSize = mFacePileAvatarSizeExpandedGroup; facepileAvatarSize = mFacePileAvatarSizeExpandedGroup;
facePileBackgroundSize = facepileAvatarSize + 2 * mFacePileProtectionWidthExpanded; facePileBackgroundSize = facepileAvatarSize + 2 * mFacePileProtectionWidthExpanded;
} }
LayoutParams layoutParams = (LayoutParams) mConversationIconView.getLayoutParams(); LayoutParams layoutParams = (LayoutParams) mConversationFacePile.getLayoutParams();
layoutParams.width = conversationAvatarSize; layoutParams.width = conversationAvatarSize;
layoutParams.height = conversationAvatarSize; layoutParams.height = conversationAvatarSize;
mConversationFacePile.setLayoutParams(layoutParams); mConversationFacePile.setLayoutParams(layoutParams);
@@ -679,29 +679,35 @@ public class ConversationLayout extends FrameLayout
* update the icon position and sizing * update the icon position and sizing
*/ */
private void updateIconPositionAndSize() { private void updateIconPositionAndSize() {
int sidemargin; int badgeProtrusion;
int conversationAvatarSize; int conversationAvatarSize;
if (mIsOneToOne || mIsCollapsed) { if (mIsOneToOne || mIsCollapsed) {
sidemargin = mBadgedSideMargins; badgeProtrusion = mBadgeProtrusion;
conversationAvatarSize = mConversationAvatarSize; conversationAvatarSize = mConversationAvatarSize;
} else { } else {
sidemargin = mConversationFacePile.getVisibility() == VISIBLE badgeProtrusion = mConversationFacePile.getVisibility() == VISIBLE
? mExpandedGroupSideMarginFacePile ? mExpandedGroupBadgeProtrusionFacePile
: mExpandedGroupSideMargin; : mExpandedGroupBadgeProtrusion;
conversationAvatarSize = mConversationAvatarSizeExpanded; conversationAvatarSize = mConversationAvatarSizeExpanded;
} }
LayoutParams layoutParams =
(LayoutParams) mConversationIconBadge.getLayoutParams();
layoutParams.topMargin = sidemargin;
layoutParams.setMarginStart(sidemargin);
mConversationIconBadge.setLayoutParams(layoutParams);
if (mConversationIconView.getVisibility() == VISIBLE) { if (mConversationIconView.getVisibility() == VISIBLE) {
layoutParams = (LayoutParams) mConversationIconView.getLayoutParams(); LayoutParams layoutParams = (LayoutParams) mConversationIconView.getLayoutParams();
layoutParams.width = conversationAvatarSize; layoutParams.width = conversationAvatarSize;
layoutParams.height = conversationAvatarSize; layoutParams.height = conversationAvatarSize;
layoutParams.leftMargin = badgeProtrusion;
layoutParams.rightMargin = badgeProtrusion;
layoutParams.bottomMargin = badgeProtrusion;
mConversationIconView.setLayoutParams(layoutParams); 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() { private void updatePaddingsBasedOnContentAvailability() {

View File

@@ -36,11 +36,14 @@
android:layout_gravity="top|center_horizontal" 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 <com.android.internal.widget.CachingIconView
android:id="@+id/conversation_icon" android:id="@+id/conversation_icon"
android:layout_width="@dimen/conversation_avatar_size" android:layout_width="@dimen/conversation_avatar_size"
android:layout_height="@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:scaleType="centerCrop"
android:importantForAccessibility="no" android:importantForAccessibility="no"
/> />
@@ -49,6 +52,9 @@
android:layout="@layout/conversation_face_pile_layout" android:layout="@layout/conversation_face_pile_layout"
android:layout_width="@dimen/conversation_avatar_size" android:layout_width="@dimen/conversation_avatar_size"
android:layout_height="@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" android:id="@+id/conversation_face_pile"
/> />
@@ -56,8 +62,7 @@
android:id="@+id/conversation_icon_badge" android:id="@+id/conversation_icon_badge"
android:layout_width="@dimen/conversation_icon_size_badged" android:layout_width="@dimen/conversation_icon_size_badged"
android:layout_height="@dimen/conversation_icon_size_badged" android:layout_height="@dimen/conversation_icon_size_badged"
android:layout_marginLeft="@dimen/conversation_badge_side_margin" android:layout_gravity="end|bottom"
android:layout_marginTop="@dimen/conversation_badge_side_margin"
android:clipChildren="false" android:clipChildren="false"
android:clipToPadding="false" android:clipToPadding="false"
> >

View File

@@ -199,13 +199,11 @@
android:id="@+id/notification_action_list_margin_target" android:id="@+id/notification_action_list_margin_target"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="-20dp"
android:clipChildren="false" android:clipChildren="false"
android:orientation="vertical"> android:orientation="vertical">
<include layout="@layout/notification_template_smart_reply_container" <include layout="@layout/notification_template_smart_reply_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/notification_content_margin"
android:layout_marginStart="@dimen/notification_content_margin_start" android:layout_marginStart="@dimen/notification_content_margin_start"
android:layout_marginEnd="@dimen/notification_content_margin_end" /> android:layout_marginEnd="@dimen/notification_content_margin_end" />
<include layout="@layout/notification_material_action_list" /> <include layout="@layout/notification_material_action_list" />

View File

@@ -776,8 +776,8 @@
<dimen name="conversation_expand_button_height">88dp</dimen> <dimen name="conversation_expand_button_height">88dp</dimen>
<!-- this is the margin between the Conversation image and the content --> <!-- this is the margin between the Conversation image and the content -->
<dimen name="conversation_image_start_margin">12dp</dimen> <dimen name="conversation_image_start_margin">12dp</dimen>
<!-- Side margins of the conversation badge in relation to the conversation icon --> <!-- amount the badge sticks out from the conversation avatar -->
<dimen name="conversation_badge_side_margin">32dp</dimen> <dimen name="conversation_badge_protrusion">4dp</dimen>
<!-- size of the notification badge when applied to the conversation icon --> <!-- size of the notification badge when applied to the conversation icon -->
<dimen name="conversation_icon_size_badged">20dp</dimen> <dimen name="conversation_icon_size_badged">20dp</dimen>
<!-- size of the conversation avatar in an expanded group --> <!-- size of the conversation avatar in an expanded group -->
@@ -786,10 +786,10 @@
<dimen name="conversation_face_pile_avatar_size">32dp</dimen> <dimen name="conversation_face_pile_avatar_size">32dp</dimen>
<!-- size of the face pile icons when the group is expanded --> <!-- 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> <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--> <!-- amount the badge sticks out from the conversation avatar when the group is expanded -->
<dimen name="conversation_badge_side_margin_group_expanded">@dimen/conversation_badge_side_margin</dimen> <dimen name="conversation_badge_protrusion_group_expanded">@dimen/conversation_badge_protrusion</dimen>
<!-- Side margins of the conversation badge in relation to the conversation icon when the group is expanded--> <!-- amount the badge sticks out from the conversation face pile when the group is expanded -->
<dimen name="conversation_badge_side_margin_group_expanded_face_pile">@dimen/conversation_badge_side_margin</dimen> <dimen name="conversation_badge_protrusion_group_expanded_face_pile">@dimen/conversation_badge_protrusion</dimen>
<!-- The width of the protection of the face pile layout--> <!-- The width of the protection of the face pile layout-->
<dimen name="conversation_face_pile_protection_width">2dp</dimen> <dimen name="conversation_face_pile_protection_width">2dp</dimen>
<!-- The width of the protection of the face pile layout when expanded--> <!-- 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--> <!-- The top padding of the conversation icon container when the avatar is small-->
<dimen name="conversation_icon_container_top_padding_small_avatar">8dp</dimen> <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 --> <!-- 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">38dp</dimen> <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 --> <!-- 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> <dimen name="messaging_layout_icon_padding_start">4dp</dimen>

View File

@@ -4084,15 +4084,15 @@
<java-symbol type="id" name="conversation_image_message_container" /> <java-symbol type="id" name="conversation_image_message_container" />
<java-symbol type="id" name="conversation_icon_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="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" />
<java-symbol type="dimen" name="conversation_avatar_size_group_expanded" /> <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" />
<java-symbol type="dimen" name="conversation_face_pile_avatar_size_group_expanded" /> <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" />
<java-symbol type="dimen" name="conversation_face_pile_protection_width_expanded" /> <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_protrusion_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_face_pile" />
<java-symbol type="dimen" name="conversation_content_start" /> <java-symbol type="dimen" name="conversation_content_start" />
<java-symbol type="dimen" name="expanded_group_conversation_message_padding" /> <java-symbol type="dimen" name="expanded_group_conversation_message_padding" />
<java-symbol type="dimen" name="messaging_layout_icon_padding_start" /> <java-symbol type="dimen" name="messaging_layout_icon_padding_start" />

View File

@@ -45,11 +45,14 @@
android:layout_marginEnd="12dp" android:layout_marginEnd="12dp"
> >
<!-- Big icon: 52x52, 12dp padding left + top, 16dp padding right --> <!-- Big icon: 48x48, 12dp padding top, 16dp padding sides -->
<ImageView <ImageView
android:id="@+id/conversation_icon" android:id="@+id/conversation_icon"
android:layout_width="@*android:dimen/conversation_avatar_size" android:layout_width="@*android:dimen/conversation_avatar_size"
android:layout_height="@*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:scaleType="centerCrop"
android:importantForAccessibility="no" android:importantForAccessibility="no"
/> />
@@ -58,8 +61,7 @@
android:id="@+id/conversation_icon_badge" android:id="@+id/conversation_icon_badge"
android:layout_width="@*android:dimen/conversation_icon_size_badged" android:layout_width="@*android:dimen/conversation_icon_size_badged"
android:layout_height="@*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_gravity="end|bottom"
android:layout_marginTop="@*android:dimen/conversation_badge_side_margin"
android:clipChildren="false" android:clipChildren="false"
android:clipToPadding="false" android:clipToPadding="false"
> >