<?xml version="1.0" encoding="utf-8"?>
<org.thoughtcrime.securesms.conversation.ConversationItem xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:viewBindingIgnore="true"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/conversation_item"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clipChildren="false"
    android:clipToPadding="false"
    android:focusable="true"
    android:nextFocusLeft="@+id/conversation_item"
    android:nextFocusRight="@+id/embedded_text_editor"
    android:orientation="vertical"
    android:paddingStart="@dimen/conversation_individual_received_left_gutter"
    android:paddingEnd="@dimen/conversation_individual_right_gutter">

    <FrameLayout
        android:id="@+id/reply_icon_wrapper"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignStart="@id/body_bubble"
        android:layout_alignTop="@id/body_bubble"
        android:layout_alignBottom="@id/body_bubble"
        android:alpha="0">

        <androidx.appcompat.widget.AppCompatImageView
            android:id="@+id/reply_icon"
            android:layout_width="@dimen/conversation_item_reply_size"
            android:layout_height="@dimen/conversation_item_reply_size"
            android:layout_gravity="center"
            android:padding="9dp"
            android:tint="@color/signal_icon_tint_primary"
            app:srcCompat="@drawable/ic_reply_24" />

    </FrameLayout>

    <FrameLayout
        android:id="@+id/contact_photo_container"
        android:layout_width="@dimen/conversation_item_avatar_size"
        android:layout_height="@dimen/conversation_item_avatar_size"
        android:layout_alignBottom="@id/body_bubble"
        android:layout_alignParentStart="true"
        android:layout_marginStart="4dp">

        <org.thoughtcrime.securesms.components.AvatarImageView
            android:id="@+id/contact_photo"
            android:layout_width="@dimen/conversation_item_avatar_size"
            android:layout_height="@dimen/conversation_item_avatar_size"
            android:contentDescription="@string/conversation_item_received__contact_photo_description"
            android:cropToPadding="true"
            android:foreground="@drawable/contact_photo_background"
            app:fallbackImageSize="small" />

    </FrameLayout>

    <org.thoughtcrime.securesms.badges.BadgeImageView
        android:id="@+id/badge"
        android:layout_width="16dp"
        android:layout_height="16dp"
        android:layout_alignStart="@id/contact_photo_container"
        android:layout_alignTop="@id/contact_photo_container"
        android:layout_marginStart="14dp"
        android:layout_marginTop="16dp"
        android:visibility="gone"
        app:badge_size="small" />

    <org.thoughtcrime.securesms.conversation.ConversationItemBodyBubble
        android:id="@+id/body_bubble"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginEnd="@dimen/message_bubble_edge_margin"
        android:layout_toEndOf="@id/contact_photo_container"
        android:background="@color/white"
        android:clipChildren="false"
        android:clipToPadding="false"
        android:orientation="vertical"
        tools:background="@drawable/message_bubble_background_received_alone"
        tools:backgroundTint="@color/signal_colorSurfaceVariant">

        <LinearLayout
            android:id="@+id/group_sender_holder"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="7dp"
            android:layout_marginBottom="-3dp"
            android:orientation="horizontal"
            android:paddingStart="@dimen/message_bubble_horizontal_padding"
            android:paddingEnd="@dimen/message_bubble_horizontal_padding"
            android:visibility="gone"
            tools:visibility="visible">

            <org.thoughtcrime.securesms.components.emoji.EmojiTextView
                android:id="@+id/group_message_sender"
                style="@style/TextAppearance.Signal.Subtitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginEnd="4sp"
                android:ellipsize="end"
                android:maxLines="1"
                android:textColor="@color/signal_text_primary"
                android:textStyle="bold"
                tools:text="+14152222222"
                tools:visibility="visible" />

        </LinearLayout>

        <LinearLayout
            android:id="@+id/story_reacted_label_holder"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="7dp"
            android:layout_marginBottom="-3dp"
            android:orientation="horizontal"
            android:paddingStart="@dimen/message_bubble_horizontal_padding"
            android:paddingEnd="@dimen/message_bubble_horizontal_padding"
            android:visibility="gone"
            tools:visibility="visible">

            <org.thoughtcrime.securesms.components.emoji.EmojiTextView
                android:id="@+id/story_reacted_label"
                style="@style/TextAppearance.Signal.Subtitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginEnd="4sp"
                android:ellipsize="end"
                android:maxLines="1"
                android:textColor="@color/signal_text_secondary"
                tools:text="Reacted to your story" />

        </LinearLayout>

        <org.thoughtcrime.securesms.components.QuoteView
            android:id="@+id/quote_view"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="6dp"
            android:layout_marginTop="@dimen/message_bubble_top_padding"
            android:layout_marginEnd="6dp"
            android:visibility="gone"
            app:message_type="incoming"
            app:quote_colorPrimary="@color/conversation_item_quote_text_color"
            app:quote_colorSecondary="@color/conversation_item_quote_text_color"
            tools:background="@color/transparent_black_05"
            tools:visibility="visible" />

        <ViewStub
            android:id="@+id/shared_contact_view_stub"
            android:layout_width="@dimen/media_bubble_default_dimens"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/message_bubble_top_padding"
            android:layout="@layout/conversation_item_received_shared_contact"
            android:visibility="gone" />

        <ViewStub
            android:id="@+id/image_view_stub"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout="@layout/conversation_item_received_thumbnail" />

        <ViewStub
            android:id="@+id/sticker_view_stub"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/message_bubble_top_padding"
            android:layout="@layout/conversation_item_received_sticker" />

        <ViewStub
            android:id="@+id/link_preview_stub"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout="@layout/conversation_item_received_link_preview" />

        <ViewStub
            android:id="@+id/audio_view_stub"
            android:layout_width="@dimen/message_audio_width"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/message_bubble_horizontal_padding"
            android:layout_marginTop="@dimen/message_bubble_top_padding_audio"
            android:layout_marginEnd="@dimen/message_bubble_horizontal_padding"
            android:layout_marginBottom="@dimen/message_bubble_collapsed_footer_padding"
            android:layout="@layout/conversation_item_received_audio" />

        <ViewStub
            android:id="@+id/document_view_stub"
            android:layout_width="210dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/message_bubble_horizontal_padding"
            android:layout_marginTop="@dimen/message_bubble_top_padding"
            android:layout_marginEnd="@dimen/message_bubble_horizontal_padding"
            android:layout_marginBottom="@dimen/message_bubble_bottom_padding"
            android:layout="@layout/conversation_item_received_document" />

        <ViewStub
            android:id="@+id/revealable_view_stub"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/message_bubble_horizontal_padding"
            android:layout_marginTop="@dimen/message_bubble_top_padding"
            android:layout_marginEnd="@dimen/message_bubble_horizontal_padding"
            android:layout_marginBottom="@dimen/message_bubble_bottom_padding"
            android:layout="@layout/conversation_item_received_revealable" />

        <ViewStub
            android:id="@+id/gift_view_stub"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout="@layout/conversation_item_received_gift" />

        <ViewStub
            android:id="@+id/payment_view_stub"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout="@layout/conversation_item_payment" />

        <org.thoughtcrime.securesms.components.emoji.EmojiTextView
            android:id="@+id/conversation_item_body"
            style="@style/Signal.Text.Body"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/message_bubble_horizontal_padding"
            android:layout_marginTop="@dimen/message_bubble_top_padding"
            android:layout_marginEnd="@dimen/message_bubble_horizontal_padding"
            android:layout_marginBottom="@dimen/message_bubble_bottom_padding"
            android:textColor="@color/signal_text_primary"
            android:textColorLink="@color/signal_text_primary"
            app:emoji_maxLength="1000"
            app:measureLastLine="true"
            app:scaleEmojis="true"
            tools:text="Mango pickle lorem ipsum" />

        <ViewStub
            android:id="@+id/conversation_item_call_to_action_stub"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="8dp"
            android:layout="@layout/conversation_item_call_to_action" />

        <org.thoughtcrime.securesms.components.ConversationItemFooter
            android:id="@+id/conversation_item_footer"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="end"
            android:layout_marginStart="@dimen/message_bubble_horizontal_padding"
            android:layout_marginTop="-5dp"
            android:layout_marginEnd="@dimen/message_bubble_horizontal_padding"
            android:layout_marginBottom="@dimen/message_bubble_bottom_padding"
            android:alpha="0.7"
            android:clipChildren="false"
            android:clipToPadding="false"
            app:footer_icon_color="@color/conversation_item_sent_text_secondary_color"
            app:footer_mode="incoming"
            app:footer_reveal_dot_color="@color/conversation_item_sent_text_secondary_color"
            app:footer_text_color="@color/conversation_item_sent_text_secondary_color" />

        <org.thoughtcrime.securesms.components.ConversationItemFooter
            android:id="@+id/conversation_item_sticker_footer"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="end"
            android:layout_marginStart="@dimen/message_bubble_horizontal_padding"
            android:layout_marginTop="2dp"
            android:clipChildren="false"
            android:clipToPadding="false"
            android:paddingStart="@dimen/message_bubble_horizontal_padding"
            android:paddingTop="3dp"
            android:paddingEnd="@dimen/message_bubble_horizontal_padding"
            android:paddingBottom="3dp"
            android:visibility="gone"
            app:footer_icon_color="@color/signal_icon_tint_secondary"
            app:footer_mode="incoming"
            app:footer_reveal_dot_color="@color/signal_icon_tint_secondary"
            app:footer_text_color="@color/signal_text_secondary" />

    </org.thoughtcrime.securesms.conversation.ConversationItemBodyBubble>

    <org.thoughtcrime.securesms.components.AlertView
        android:id="@+id/indicators_parent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toStartOf="@id/quoted_indicator"
        android:gravity="center_vertical"
        android:orientation="vertical"
        android:visibility="gone"/>

    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignEnd="@id/body_bubble"
        android:layout_alignTop="@id/body_bubble"
        android:layout_alignBottom="@id/body_bubble"
        android:layout_marginEnd="-42dp" >

        <androidx.appcompat.widget.AppCompatImageView
            android:id="@+id/quoted_indicator"
            android:layout_width="32dp"
            android:layout_height="32dp"
            android:layout_gravity="center_vertical"
            android:background="@drawable/circle_tintable"
            android:backgroundTint="@color/signal_colorSurfaceVariant"
            android:padding="6dp"
            android:tint="@color/signal_colorOnSurfaceVariant"
            app:srcCompat="@drawable/ic_replies_outline_20" />

    </FrameLayout>

    <org.thoughtcrime.securesms.reactions.ReactionsConversationView
        android:id="@+id/reactions_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/body_bubble"
        android:layout_alignStart="@id/body_bubble"
        android:layout_marginTop="-4dp"
        android:orientation="horizontal"
        app:rcv_outgoing="false" />

</org.thoughtcrime.securesms.conversation.ConversationItem>
