<?xml version="1.0" encoding="utf-8"?>
<org.thoughtcrime.securesms.ConversationListItem
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:background="?attr/conversation_list_item_background"
    android:layout_width="match_parent"
    android:focusable="true"
    android:nextFocusRight="@+id/fab"
    android:nextFocusLeft="@+id/container"
    android:layout_height="72dp">

    <org.thoughtcrime.securesms.components.AvatarView
        android:id="@+id/avatar"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_centerVertical="true"
        android:importantForAccessibility="no"
        android:layout_marginLeft="12dp"
        android:layout_marginRight="12dp" />

    <LinearLayout
        android:orientation="horizontal"
        android:gravity="center_vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_toRightOf="@id/avatar"
        android:layout_toEndOf="@id/avatar">

        <LinearLayout
            android:orientation="vertical"
            android:layout_weight="2"
            android:layout_width="0dp"
            android:layout_height="wrap_content">

            <org.thoughtcrime.securesms.components.FromTextView
                android:id="@+id/from_text"
                style="@style/Signal.Text.Body"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="2dp"
                android:drawablePadding="5dp"
                android:ellipsize="end"
                android:fontFamily="sans-serif-medium"
                android:singleLine="true"
                android:textColor="?attr/conversation_list_item_contact_color"
                tools:text="Jules Bonnot" />
            <!-- Attention: Using android:maxLines="1", if the name is an emoji followed by a long word
                and the chat is muted, then the long word is not shown at all (instead of using `…`). That's why we use
                android:singleLine="true" -->

            <androidx.appcompat.widget.AppCompatTextView
                android:id="@+id/subject"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                style="@style/Signal.Text.Preview"
                android:textColor="?attr/conversation_list_item_subject_color"
                android:maxLines="1"
                tools:text="Wheels arrive at 3pm flat. This is a somewhat longer message."
                android:ellipsize="end" />

        </LinearLayout>

        <LinearLayout
            android:orientation="vertical"
            android:gravity="end"
            android:layout_marginLeft="24dp"
            android:layout_marginStart="24dp"
            android:layout_marginRight="12dp"
            android:layout_marginEnd="12dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <TextView
                android:id="@id/date"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:drawablePadding="5dp"
                style="@style/Signal.Text.Caption"
                android:textColor="?attr/conversation_list_item_date_color"
                tools:text="30 mins"
                android:singleLine="true" />

            <LinearLayout
                android:orientation="horizontal"
                android:minHeight="21dp"
                android:showDividers="middle"
                android:divider="@drawable/badge_divider"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">

                <TextView
                    android:id="@+id/request_badge"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingLeft="5dp"
                    android:paddingRight="5dp"
                    android:paddingTop="1dp"
                    android:paddingBottom="1dp"
                    style="@style/Signal.Text.Caption"
                    android:text="@string/chat_request_label"
                    android:textColor="?attr/conversation_list_item_date_color"
                    android:background="@drawable/archived_indicator_background" />

                <TextView
                    android:id="@+id/archived_badge"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingLeft="5dp"
                    android:paddingRight="5dp"
                    android:paddingTop="1dp"
                    android:paddingBottom="1dp"
                    style="@style/Signal.Text.Caption"
                    android:text="@string/chat_archived_label"
                    android:textColor="?attr/conversation_list_item_date_color"
                    android:background="@drawable/archived_indicator_background" />

                <ImageView
                    android:id="@+id/delivery_indicator"
                    android:layout_marginTop="4dp"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical|end"
                    android:tint="?attr/conversation_item_outgoing_text_secondary_color"
                    android:visibility="gone" />

                <ImageView
                    android:id="@+id/unread_indicator"
                    android:layout_width="24dp"
                    android:layout_height="24dp" />
            </LinearLayout>

        </LinearLayout>

    </LinearLayout>

    <View
        android:id="@+id/item_divider"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_alignParentBottom="true"
        android:background="?attr/conversation_list_item_divider" />

</org.thoughtcrime.securesms.ConversationListItem>
