Merge "Made the old MessagingLayout work again" into rvc-dev

This commit is contained in:
Selim Cinek
2020-03-16 19:44:06 +00:00
committed by Android (Google) Code Review
6 changed files with 36 additions and 1 deletions

View File

@@ -652,6 +652,7 @@ public class ConversationLayout extends FrameLayout
mAddedGroups.add(newGroup);
}
newGroup.setDisplayImagesAtEnd(mIsCollapsed);
newGroup.setIsInConversation(true);
newGroup.setLayoutColor(mLayoutColor);
newGroup.setTextColors(mSenderTextColor, mMessageTextColor);
Person sender = senders.get(groupIndex);

View File

@@ -85,6 +85,10 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou
private int mSenderTextPaddingSingleLine;
private boolean mIsFirstGroupInLayout = true;
private boolean mCanHideSenderIfFirst;
private boolean mIsInConversation = true;
private ViewGroup mMessagingIconContainer;
private int mConversationContentStart;
private int mNonConversationMarginEnd;
public MessagingGroup(@NonNull Context context) {
super(context);
@@ -112,6 +116,7 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou
mAvatarView = findViewById(R.id.message_icon);
mImageContainer = findViewById(R.id.messaging_group_icon_container);
mSendingSpinner = findViewById(R.id.messaging_group_sending_progress);
mMessagingIconContainer = findViewById(R.id.message_icon_container);
mContentContainer = findViewById(R.id.messaging_group_content_container);
mSendingSpinnerContainer = findViewById(R.id.messaging_group_sending_progress_container);
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
@@ -119,6 +124,10 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou
mDisplaySize.y = displayMetrics.heightPixels;
mSenderTextPaddingSingleLine = getResources().getDimensionPixelSize(
R.dimen.messaging_group_singleline_sender_padding_end);
mConversationContentStart = getResources().getDimensionPixelSize(
R.dimen.conversation_content_start);
mNonConversationMarginEnd = getResources().getDimensionPixelSize(
R.dimen.messaging_layout_margin_end);
}
public void updateClipRect() {
@@ -644,4 +653,21 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou
public boolean isSingleLine() {
return mSingleLine;
}
/**
* Set this group to be displayed in a conversation and adjust the visual appearance
*
* @param isInConversation is this in a conversation
*/
public void setIsInConversation(boolean isInConversation) {
if (mIsInConversation != isInConversation) {
mIsInConversation = isInConversation;
MarginLayoutParams layoutParams =
(MarginLayoutParams) mMessagingIconContainer.getLayoutParams();
layoutParams.width = mIsInConversation ? mConversationContentStart
: ViewPager.LayoutParams.WRAP_CONTENT;
layoutParams.setMarginEnd(mIsInConversation ? 0 : mNonConversationMarginEnd);
mMessagingIconContainer.setLayoutParams(layoutParams);
}
}
}

View File

@@ -448,6 +448,7 @@ public class MessagingLayout extends FrameLayout
mAddedGroups.add(newGroup);
}
newGroup.setDisplayImagesAtEnd(mDisplayImagesAtEnd);
newGroup.setIsInConversation(false);
newGroup.setLayoutColor(mLayoutColor);
newGroup.setTextColors(mSenderTextColor, mMessageTextColor);
Person sender = senders.get(groupIndex);

View File

@@ -21,8 +21,9 @@
android:layout_height="wrap_content"
android:orientation="horizontal" >
<FrameLayout
android:id="@+id/message_icon_container"
android:layout_width="@dimen/conversation_content_start"
android:layout_height="wrap_content"> <!--TODO: make sure to make this padding dynamic-->
android:layout_height="wrap_content">
<ImageView
android:layout_gravity="top|center_horizontal"
android:id="@+id/message_icon"

View File

@@ -699,6 +699,9 @@
<!-- margin on the top when the icon is centered for group conversations -->
<dimen name="conversation_icon_margin_top_centered">5dp</dimen>
<!-- margin at the end of messaging group icons when not conversations -->
<dimen name="messaging_layout_margin_end">12dp</dimen>
<!-- Padding between text and sender when singleline -->
<dimen name="messaging_group_singleline_sender_padding_end">4dp</dimen>

View File

@@ -3891,6 +3891,7 @@
<java-symbol type="id" name="conversation_face_pile_top" />
<java-symbol type="id" name="conversation_face_pile" />
<java-symbol type="id" name="conversation_text" />
<java-symbol type="id" name="message_icon_container" />
<java-symbol type="dimen" name="conversation_expand_button_top_margin_expanded" />
<java-symbol type="dimen" name="conversation_expand_button_expanded_size" />
<java-symbol type="dimen" name="messaging_group_singleline_sender_padding_end" />
@@ -3898,6 +3899,8 @@
<java-symbol type="dimen" name="conversation_icon_size_badged" />
<java-symbol type="dimen" name="conversation_icon_size_centered" />
<java-symbol type="dimen" name="conversation_icon_margin_top_centered" />
<java-symbol type="dimen" name="conversation_content_start" />
<java-symbol type="dimen" name="messaging_layout_margin_end" />
<java-symbol type="layout" name="notification_template_material_conversation" />
<java-symbol type="layout" name="conversation_face_pile_layout" />