Merge "Change icon alignment for collapsed Conversation groups" into sc-dev
This commit is contained in:
@@ -128,6 +128,8 @@ public class ConversationLayout extends FrameLayout
|
||||
private CharSequence mFallbackChatName;
|
||||
private CharSequence mFallbackGroupChatName;
|
||||
private CharSequence mConversationTitle;
|
||||
private int mMessageSpacingStandard;
|
||||
private int mMessageSpacingGroup;
|
||||
private int mNotificationHeaderExpandedPadding;
|
||||
private View mConversationHeader;
|
||||
private View mContentContainer;
|
||||
@@ -241,6 +243,10 @@ public class ConversationLayout extends FrameLayout
|
||||
mContentContainer = findViewById(R.id.notification_action_list_margin_target);
|
||||
mExpandButtonAndContentContainer = findViewById(R.id.expand_button_and_content_container);
|
||||
mExpandButton = findViewById(R.id.expand_button);
|
||||
mMessageSpacingStandard = getResources().getDimensionPixelSize(
|
||||
R.dimen.notification_messaging_spacing);
|
||||
mMessageSpacingGroup = getResources().getDimensionPixelSize(
|
||||
R.dimen.notification_messaging_spacing_conversation_group);
|
||||
mNotificationHeaderExpandedPadding = getResources().getDimensionPixelSize(
|
||||
R.dimen.conversation_header_expanded_padding_end);
|
||||
mContentMarginEnd = getResources().getDimensionPixelSize(
|
||||
@@ -699,6 +705,10 @@ public class ConversationLayout extends FrameLayout
|
||||
}
|
||||
|
||||
private void updatePaddingsBasedOnContentAvailability() {
|
||||
// groups have avatars that need more spacing
|
||||
mMessagingLinearLayout.setSpacing(
|
||||
mIsOneToOne ? mMessageSpacingStandard : mMessageSpacingGroup);
|
||||
|
||||
int messagingPadding = mIsOneToOne || mIsCollapsed
|
||||
? 0
|
||||
// Add some extra padding to the messages, since otherwise it will overlap with the
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.internal.widget;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.Px;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
@@ -251,6 +252,16 @@ public class MessagingLinearLayout extends ViewGroup {
|
||||
return super.drawChild(canvas, child, drawingTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the spacing to be applied between views.
|
||||
*/
|
||||
public void setSpacing(@Px int spacing) {
|
||||
if (mSpacing != spacing) {
|
||||
mSpacing = spacing;
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public LayoutParams generateLayoutParams(AttributeSet attrs) {
|
||||
return new LayoutParams(mContext, attrs);
|
||||
|
||||
@@ -367,6 +367,9 @@
|
||||
<!-- The spacing between messages in Notification.MessagingStyle -->
|
||||
<dimen name="notification_messaging_spacing">6dp</dimen>
|
||||
|
||||
<!-- The spacing between messages in Notification.MessagingStyle -->
|
||||
<dimen name="notification_messaging_spacing_conversation_group">24dp</dimen>
|
||||
|
||||
<!-- The rounding for messaging images -->
|
||||
<dimen name="messaging_image_rounding">4dp</dimen>
|
||||
|
||||
@@ -760,7 +763,7 @@
|
||||
<!-- The maximum size of the grayscale icon -->
|
||||
<dimen name="notification_grayscale_icon_max_size">256dp</dimen>
|
||||
|
||||
<dimen name="messaging_avatar_size">36dp</dimen>
|
||||
<dimen name="messaging_avatar_size">48dp</dimen>
|
||||
<dimen name="conversation_avatar_size">48dp</dimen>
|
||||
<!-- start margin of the icon circle in the conversation's skin of the header -->
|
||||
<dimen name="conversation_icon_circle_start">28dp</dimen>
|
||||
@@ -779,17 +782,17 @@
|
||||
<!-- size of the face pile icons -->
|
||||
<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">25dp</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-->
|
||||
<dimen name="conversation_badge_side_margin_group_expanded">22dp</dimen>
|
||||
<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">18dp</dimen>
|
||||
<dimen name="conversation_badge_side_margin_group_expanded_face_pile">@dimen/conversation_badge_side_margin</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-->
|
||||
<dimen name="conversation_face_pile_protection_width_expanded">1dp</dimen>
|
||||
<dimen name="conversation_face_pile_protection_width_expanded">@dimen/conversation_face_pile_protection_width</dimen>
|
||||
<!-- The padding of the expanded message container-->
|
||||
<dimen name="expanded_group_conversation_message_padding">17dp</dimen>
|
||||
<dimen name="expanded_group_conversation_message_padding">32dp</dimen>
|
||||
<!-- The stroke width of the ring used to visually mark a conversation as important -->
|
||||
<dimen name="importance_ring_stroke_width">2dp</dimen>
|
||||
<!-- The maximum stroke width used for the animation shown when a conversation is marked as important -->
|
||||
@@ -801,7 +804,7 @@
|
||||
<dimen name="conversation_icon_container_top_padding">20dp</dimen>
|
||||
|
||||
<!-- The top padding of the conversation icon container when the avatar is small-->
|
||||
<dimen name="conversation_icon_container_top_padding_small_avatar">9dp</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 -->
|
||||
<dimen name="conversation_header_expanded_padding_end">38dp</dimen>
|
||||
|
||||
@@ -302,10 +302,6 @@ easier.
|
||||
<style name="TextAppearance.DeviceDefault.Notification.Time" parent="TextAppearance.Material.Notification.Time">
|
||||
<item name="fontFamily">@string/config_bodyFontFamily</item>
|
||||
</style>
|
||||
<style name="TextAppearance.DeviceDefault.Notification.Conversation.AppName"
|
||||
parent="TextAppearance.Material.Notification.Conversation.AppName">
|
||||
<item name="fontFamily">@string/config_headlineFontFamilyMedium</item>
|
||||
</style>
|
||||
<style name="TextAppearance.DeviceDefault.Widget" parent="TextAppearance.Material.Widget">
|
||||
<item name="fontFamily">@string/config_bodyFontFamily</item>
|
||||
</style>
|
||||
|
||||
@@ -497,10 +497,6 @@ please see styles_device_defaults.xml.
|
||||
<!-- unused; keep identical to parent -->
|
||||
<style name="TextAppearance.Material.Notification.Emphasis"/>
|
||||
|
||||
<style name="TextAppearance.Material.Notification.Conversation.AppName" parent="TextAppearance.Material.Notification.Title">
|
||||
<item name="android:textSize">16sp</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.Material.ListItem" parent="TextAppearance.Material.Subhead" />
|
||||
<style name="TextAppearance.Material.ListItemSecondary" parent="TextAppearance.Material.Body1" />
|
||||
|
||||
|
||||
@@ -3083,6 +3083,7 @@
|
||||
<java-symbol type="string" name="negative_duration" />
|
||||
|
||||
<java-symbol type="dimen" name="notification_messaging_spacing" />
|
||||
<java-symbol type="dimen" name="notification_messaging_spacing_conversation_group" />
|
||||
|
||||
<java-symbol type="dimen" name="notification_text_margin_top" />
|
||||
<java-symbol type="dimen" name="notification_inbox_item_top_padding" />
|
||||
@@ -4090,7 +4091,6 @@
|
||||
<java-symbol type="dimen" name="button_inset_horizontal_material" />
|
||||
<java-symbol type="layout" name="conversation_face_pile_layout" />
|
||||
<java-symbol type="string" name="unread_convo_overflow" />
|
||||
<java-symbol type="style" name="TextAppearance.DeviceDefault.Notification.Conversation.AppName" />
|
||||
<java-symbol type="drawable" name="conversation_badge_background" />
|
||||
<java-symbol type="drawable" name="conversation_badge_ring" />
|
||||
<java-symbol type="color" name="conversation_important_highlight" />
|
||||
|
||||
@@ -26,21 +26,22 @@
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="@*android:dimen/conversation_content_start"
|
||||
android:layout_height="25dp"
|
||||
android:layout_height="@dimen/conversation_single_line_face_pile_size"
|
||||
android:paddingHorizontal="16dp"
|
||||
>
|
||||
<ImageView
|
||||
android:id="@*android:id/conversation_icon"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="@dimen/conversation_single_line_avatar_size"
|
||||
android:layout_height="@dimen/conversation_single_line_avatar_size"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
/>
|
||||
|
||||
<ViewStub
|
||||
android:id="@*android:id/conversation_face_pile"
|
||||
android:layout="@*android:layout/conversation_face_pile_layout"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="@dimen/conversation_single_line_face_pile_size"
|
||||
android:layout_height="@dimen/conversation_single_line_face_pile_size"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
@@ -696,8 +696,11 @@
|
||||
<!-- Size of the face pile shown on one-line (children of a group) conversation notifications -->
|
||||
<dimen name="conversation_single_line_face_pile_size">25dp</dimen>
|
||||
|
||||
<!-- Size of the avatars within a face pile shown on one-line (children of a group) conversation notifications -->
|
||||
<dimen name="conversation_single_line_face_pile_avatar_size">17dp</dimen>
|
||||
|
||||
<!-- Size of an avatar shown on one-line (children of a group) conversation notifications -->
|
||||
<dimen name="conversation_single_line_avatar_size">20dp</dimen>
|
||||
<dimen name="conversation_single_line_avatar_size">24dp</dimen>
|
||||
|
||||
<!-- Border width for avatars in the face pile shown on one-line (children of a group) conversation notifications -->
|
||||
<dimen name="conversation_single_line_face_pile_protection_width">1dp</dimen>
|
||||
|
||||
@@ -37,8 +37,9 @@ public class HybridConversationNotificationView extends HybridNotificationView {
|
||||
private ImageView mConversationIconView;
|
||||
private TextView mConversationSenderName;
|
||||
private View mConversationFacePile;
|
||||
private int mConversationIconSize;
|
||||
private int mSingleAvatarSize;
|
||||
private int mFacePileSize;
|
||||
private int mFacePileAvatarSize;
|
||||
private int mFacePileProtectionWidth;
|
||||
|
||||
public HybridConversationNotificationView(Context context) {
|
||||
@@ -67,7 +68,9 @@ public class HybridConversationNotificationView extends HybridNotificationView {
|
||||
mConversationSenderName = requireViewById(R.id.conversation_notification_sender);
|
||||
mFacePileSize = getResources()
|
||||
.getDimensionPixelSize(R.dimen.conversation_single_line_face_pile_size);
|
||||
mConversationIconSize = getResources()
|
||||
mFacePileAvatarSize = getResources()
|
||||
.getDimensionPixelSize(R.dimen.conversation_single_line_face_pile_avatar_size);
|
||||
mSingleAvatarSize = getResources()
|
||||
.getDimensionPixelSize(R.dimen.conversation_single_line_avatar_size);
|
||||
mFacePileProtectionWidth = getResources().getDimensionPixelSize(
|
||||
R.dimen.conversation_single_line_face_pile_protection_width);
|
||||
@@ -89,6 +92,7 @@ public class HybridConversationNotificationView extends HybridNotificationView {
|
||||
mConversationFacePile.setVisibility(GONE);
|
||||
mConversationIconView.setVisibility(VISIBLE);
|
||||
mConversationIconView.setImageIcon(conversationIcon);
|
||||
setSize(mConversationIconView, mSingleAvatarSize);
|
||||
} else {
|
||||
// If there isn't an icon, generate a "face pile" based on the sender avatars
|
||||
mConversationIconView.setVisibility(GONE);
|
||||
@@ -104,9 +108,9 @@ public class HybridConversationNotificationView extends HybridNotificationView {
|
||||
com.android.internal.R.id.conversation_face_pile_top);
|
||||
conversationLayout.bindFacePile(facePileBottomBg, facePileBottom, facePileTop);
|
||||
setSize(mConversationFacePile, mFacePileSize);
|
||||
setSize(facePileBottom, mConversationIconSize);
|
||||
setSize(facePileTop, mConversationIconSize);
|
||||
setSize(facePileBottomBg, mConversationIconSize + 2 * mFacePileProtectionWidth);
|
||||
setSize(facePileBottom, mFacePileAvatarSize);
|
||||
setSize(facePileTop, mFacePileAvatarSize);
|
||||
setSize(facePileBottomBg, mFacePileAvatarSize + 2 * mFacePileProtectionWidth);
|
||||
mTransformationHelper.addViewTransformingToSimilar(facePileTop);
|
||||
mTransformationHelper.addViewTransformingToSimilar(facePileBottom);
|
||||
mTransformationHelper.addViewTransformingToSimilar(facePileBottomBg);
|
||||
|
||||
@@ -20,14 +20,12 @@ import static com.android.systemui.statusbar.notification.TransformState.TRANSFO
|
||||
|
||||
import android.app.Notification;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Pair;
|
||||
import android.view.NotificationHeaderView;
|
||||
import android.view.NotificationTopLineView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewGroup.MarginLayoutParams;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.view.animation.PathInterpolator;
|
||||
import android.widget.ImageButton;
|
||||
@@ -168,53 +166,6 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
public void applyConversationSkin() {
|
||||
if (mAppNameText != null) {
|
||||
final ColorStateList colors = mAppNameText.getTextColors();
|
||||
mAppNameText.setTextAppearance(
|
||||
com.android.internal.R.style
|
||||
.TextAppearance_DeviceDefault_Notification_Conversation_AppName);
|
||||
mAppNameText.setTextColor(colors);
|
||||
MarginLayoutParams layoutParams = (MarginLayoutParams) mAppNameText.getLayoutParams();
|
||||
layoutParams.setMarginStart(0);
|
||||
}
|
||||
if (mNotificationTopLine != null) {
|
||||
int paddingStart = mNotificationTopLine.getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.conversation_content_start);
|
||||
mNotificationTopLine.setPaddingStart(paddingStart);
|
||||
}
|
||||
if (mIcon != null) {
|
||||
MarginLayoutParams layoutParams = (MarginLayoutParams) mIcon.getLayoutParams();
|
||||
int marginStart = mIcon.getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.conversation_icon_circle_start);
|
||||
layoutParams.setMarginStart(marginStart);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearConversationSkin() {
|
||||
if (mAppNameText != null) {
|
||||
final ColorStateList colors = mAppNameText.getTextColors();
|
||||
mAppNameText.setTextAppearance(
|
||||
com.android.internal.R.style.TextAppearance_DeviceDefault_Notification_Info);
|
||||
mAppNameText.setTextColor(colors);
|
||||
MarginLayoutParams layoutParams = (MarginLayoutParams) mAppNameText.getLayoutParams();
|
||||
final int marginStart = mAppNameText.getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.notification_header_app_name_margin_start);
|
||||
layoutParams.setMarginStart(marginStart);
|
||||
}
|
||||
if (mNotificationTopLine != null) {
|
||||
int paddingStart = mNotificationTopLine.getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.notification_content_margin_start);
|
||||
mNotificationTopLine.setPaddingStart(paddingStart);
|
||||
}
|
||||
if (mIcon != null) {
|
||||
MarginLayoutParams layoutParams = (MarginLayoutParams) mIcon.getLayoutParams();
|
||||
int marginStart = mIcon.getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.notification_icon_circle_start);
|
||||
layoutParams.setMarginStart(marginStart);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the remaining TransformTypes to the TransformHelper. This is done to make sure that each
|
||||
* child is faded automatically and doesn't have to be manually added.
|
||||
|
||||
@@ -43,7 +43,6 @@ import com.android.systemui.statusbar.notification.collection.legacy.VisualStabi
|
||||
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
||||
import com.android.systemui.statusbar.notification.row.HybridGroupManager;
|
||||
import com.android.systemui.statusbar.notification.row.HybridNotificationView;
|
||||
import com.android.systemui.statusbar.notification.row.wrapper.NotificationHeaderViewWrapper;
|
||||
import com.android.systemui.statusbar.notification.row.wrapper.NotificationViewWrapper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -336,15 +335,6 @@ public class NotificationChildrenContainer extends ViewGroup {
|
||||
}
|
||||
mNotificationHeaderWrapper.setExpanded(mChildrenExpanded);
|
||||
mNotificationHeaderWrapper.onContentUpdated(mContainingNotification);
|
||||
if (mNotificationHeaderWrapper instanceof NotificationHeaderViewWrapper) {
|
||||
NotificationHeaderViewWrapper headerWrapper =
|
||||
(NotificationHeaderViewWrapper) mNotificationHeaderWrapper;
|
||||
if (isConversation) {
|
||||
headerWrapper.applyConversationSkin();
|
||||
} else {
|
||||
headerWrapper.clearConversationSkin();
|
||||
}
|
||||
}
|
||||
recreateLowPriorityHeader(builder, isConversation);
|
||||
updateHeaderVisibility(false /* animate */);
|
||||
updateChildrenAppearance();
|
||||
@@ -378,15 +368,6 @@ public class NotificationChildrenContainer extends ViewGroup {
|
||||
header.reapply(getContext(), mNotificationHeaderLowPriority);
|
||||
}
|
||||
mNotificationHeaderWrapperLowPriority.onContentUpdated(mContainingNotification);
|
||||
if (mNotificationHeaderWrapper instanceof NotificationHeaderViewWrapper) {
|
||||
NotificationHeaderViewWrapper headerWrapper =
|
||||
(NotificationHeaderViewWrapper) mNotificationHeaderWrapper;
|
||||
if (isConversation) {
|
||||
headerWrapper.applyConversationSkin();
|
||||
} else {
|
||||
headerWrapper.clearConversationSkin();
|
||||
}
|
||||
}
|
||||
resetHeaderVisibilityIfNeeded(mNotificationHeaderLowPriority, calculateDesiredHeader());
|
||||
} else {
|
||||
removeView(mNotificationHeaderLowPriority);
|
||||
|
||||
Reference in New Issue
Block a user