Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 62ee4e97 authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

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

parents 4723328c a91778a3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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);
+26 −0
Original line number Diff line number Diff line
@@ -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);
        }
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -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);
+2 −1
Original line number Diff line number Diff line
@@ -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"
+3 −0
Original line number Diff line number Diff line
@@ -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>

Loading