Merge "Move conversation app name into header" into rvc-dev am: 821b7f21b0 am: 83b97589b4 am: c233896a84

Change-Id: I005cffcc1ccc161938023db10aa4b659f6417b60
This commit is contained in:
TreeHugger Robot
2020-04-28 19:51:18 +00:00
committed by Automerger Merge Worker
4 changed files with 51 additions and 47 deletions

View File

@@ -115,10 +115,9 @@ public class ConversationLayout extends FrameLayout
private ImageResolver mImageResolver;
private CachingIconView mConversationIconView;
private View mConversationIconContainer;
private int mConversationIconTopPadding;
private int mConversationIconTopPaddingExpandedGroup;
private int mConversationIconTopPaddingNoAppName;
private int mExpandedGroupMessagePaddingNoAppName;
private int mConversationIconTopPadding;
private int mExpandedGroupMessagePadding;
private TextView mConversationText;
private View mConversationIconBadge;
private CachingIconView mConversationIconBadgeBg;
@@ -162,6 +161,7 @@ public class ConversationLayout extends FrameLayout
private Rect mAppOpsTouchRect = new Rect();
private float mMinTouchSize;
private Icon mConversationIcon;
private View mAppNameDivider;
public ConversationLayout(@NonNull Context context) {
super(context);
@@ -261,14 +261,12 @@ public class ConversationLayout extends FrameLayout
R.dimen.conversation_avatar_size);
mConversationAvatarSizeExpanded = getResources().getDimensionPixelSize(
R.dimen.conversation_avatar_size_group_expanded);
mConversationIconTopPadding = getResources().getDimensionPixelSize(
R.dimen.conversation_icon_container_top_padding);
mConversationIconTopPaddingExpandedGroup = getResources().getDimensionPixelSize(
R.dimen.conversation_icon_container_top_padding_small_avatar);
mConversationIconTopPaddingNoAppName = getResources().getDimensionPixelSize(
R.dimen.conversation_icon_container_top_padding_no_app_name);
mExpandedGroupMessagePaddingNoAppName = getResources().getDimensionPixelSize(
R.dimen.expanded_group_conversation_message_padding_without_app_name);
mConversationIconTopPadding = getResources().getDimensionPixelSize(
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(
@@ -287,6 +285,7 @@ public class ConversationLayout extends FrameLayout
mFallbackGroupChatName = getResources().getString(
R.string.conversation_title_fallback_group_chat);
mAppName = findViewById(R.id.app_name_text);
mAppNameDivider = findViewById(R.id.app_name_divider);
mAppNameGone = mAppName.getVisibility() == GONE;
mAppName.setOnVisibilityChangedListener((visibility) -> {
onAppNameVisibilityChanged();
@@ -524,6 +523,7 @@ public class ConversationLayout extends FrameLayout
updateImageMessages();
updatePaddingsBasedOnContentAvailability();
updateActionListPadding();
updateAppNameDividerVisibility();
}
private void updateActionListPadding() {
@@ -685,27 +685,15 @@ public class ConversationLayout extends FrameLayout
}
private void updatePaddingsBasedOnContentAvailability() {
int containerTopPadding;
int messagingPadding = 0;
if (mIsOneToOne || mIsCollapsed) {
containerTopPadding = mConversationIconTopPadding;
} else {
if (mAppName.getVisibility() != GONE) {
// The app name is visible, let's center outselves in the two lines
containerTopPadding = mConversationIconTopPaddingExpandedGroup;
} else {
// App name is gone, let's center ourselves int he one remaining line
containerTopPadding = mConversationIconTopPaddingNoAppName;
// The app name is gone and we're a group, we'll need to add some extra padding
// to the messages, since otherwise it will overlap with the group
messagingPadding = mExpandedGroupMessagePaddingNoAppName;
}
}
int messagingPadding = mIsOneToOne || mIsCollapsed
? 0
// Add some extra padding to the messages, since otherwise it will overlap with the
// group
: mExpandedGroupMessagePadding;
mConversationIconContainer.setPaddingRelative(
mConversationIconContainer.getPaddingStart(),
containerTopPadding,
mConversationIconTopPadding,
mConversationIconContainer.getPaddingEnd(),
mConversationIconContainer.getPaddingBottom());
@@ -1214,10 +1202,14 @@ public class ConversationLayout extends FrameLayout
boolean appNameGone = mAppName.getVisibility() == GONE;
if (appNameGone != mAppNameGone) {
mAppNameGone = appNameGone;
updatePaddingsBasedOnContentAvailability();
updateAppNameDividerVisibility();
}
}
private void updateAppNameDividerVisibility() {
mAppNameDivider.setVisibility(mAppNameGone ? GONE : VISIBLE);
}
public void updateExpandability(boolean expandable, @Nullable OnClickListener onClickListener) {
mExpandable = expandable;
if (expandable) {

View File

@@ -139,6 +139,32 @@
android:layout_weight="1"
/>
<TextView
android:id="@+id/app_name_divider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?attr/notificationHeaderTextAppearance"
android:layout_marginStart="@dimen/notification_header_separating_margin"
android:layout_marginEnd="@dimen/notification_header_separating_margin"
android:text="@string/notification_header_divider_symbol"
android:layout_gravity="center"
android:paddingTop="1sp"
android:singleLine="true"
android:visibility="gone"
/>
<!-- App Name -->
<com.android.internal.widget.ObservableTextView
android:id="@+id/app_name_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/conversation_content_start"
android:textSize="12sp"
android:layout_marginBottom="16dp"
android:textAppearance="@style/TextAppearance.DeviceDefault.Notification.Info"
/>
<TextView
android:id="@+id/time_divider"
android:layout_width="wrap_content"
@@ -230,17 +256,6 @@
</LinearLayout>
</LinearLayout>
<!-- App Name -->
<com.android.internal.widget.ObservableTextView
android:id="@+id/app_name_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/conversation_content_start"
android:textSize="12sp"
android:layout_marginBottom="16dp"
android:textAppearance="@style/TextAppearance.DeviceDefault.Notification"
/>
<!-- Messages -->
<com.android.internal.widget.MessagingLinearLayout
android:id="@+id/notification_messaging"

View File

@@ -710,14 +710,11 @@
<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>
<!-- The padding of the expanded message container when the app name is gone-->
<dimen name="expanded_group_conversation_message_padding_without_app_name">14dp</dimen>
<!-- The padding of the expanded message container-->
<dimen name="expanded_group_conversation_message_padding">14dp</dimen>
<!-- The top padding of the conversation icon container in the regular state-->
<dimen name="conversation_icon_container_top_padding">12dp</dimen>
<!-- The top padding of the conversation icon container when there's no app name present in a group-->
<dimen name="conversation_icon_container_top_padding_no_app_name">9dp</dimen>
<dimen name="conversation_icon_container_top_padding">9dp</dimen>
<!-- The top padding of the conversation icon container when the avatar is small-->
<dimen name="conversation_icon_container_top_padding_small_avatar">17.5dp</dimen>

View File

@@ -2824,6 +2824,7 @@
<java-symbol type="string" name="notification_hidden_text" />
<java-symbol type="id" name="app_name_text" />
<java-symbol type="id" name="app_name_divider" />
<java-symbol type="id" name="header_text" />
<java-symbol type="id" name="header_text_secondary" />
<java-symbol type="id" name="expand_button" />
@@ -3912,12 +3913,11 @@
<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_content_start" />
<java-symbol type="dimen" name="expanded_group_conversation_message_padding_without_app_name" />
<java-symbol type="dimen" name="expanded_group_conversation_message_padding" />
<java-symbol type="dimen" name="messaging_layout_margin_end" />
<java-symbol type="dimen" name="conversation_header_expanded_padding_end" />
<java-symbol type="dimen" name="conversation_icon_container_top_padding" />
<java-symbol type="dimen" name="conversation_icon_container_top_padding_small_avatar" />
<java-symbol type="dimen" name="conversation_icon_container_top_padding_no_app_name" />
<java-symbol type="layout" name="notification_template_material_conversation" />
<java-symbol type="dimen" name="button_padding_horizontal_material" />
<java-symbol type="dimen" name="button_inset_horizontal_material" />