<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <FrameLayout
        android:background="?colorSecondaryFixedDim"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:descendantFocusability="blocksDescendants">

        <FrameLayout
            android:background="?colorSurface"
            android:id="@+id/frame"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">

            <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:background="?android:selectableItemBackground"
                android:orientation="horizontal"
                android:padding="8dp">

                <com.google.android.material.imageview.ShapeableImageView
                    android:id="@+id/conversation_image"
                    android:layout_width="56dp"
                    android:layout_height="56dp"
                    android:layout_alignParentStart="true"
                    android:scaleType="centerCrop"
                    app:shapeAppearanceOverlay="@style/ShapeAppearance.RoundedCornersMedium" />

                <RelativeLayout
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_marginStart="@dimen/avatar_item_distance"
                    android:layout_toEndOf="@+id/conversation_image">

                    <TextView
                        android:id="@+id/conversation_name"
                        style="?textAppearanceTitleMedium"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignStart="@+id/conversation_lastwrapper"
                        android:layout_marginEnd="4dp"
                        android:layout_toStartOf="@+id/conversation_lastupdate"
                        android:ellipsize="end"
                        android:maxLines="1"
                        tools:text="Juliet Capulet" />

                    <RelativeLayout
                        android:id="@+id/conversation_lastwrapper"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/conversation_name"
                        android:layout_marginTop="4dp">

                        <TextView
                            android:id="@+id/sender_name"
                            style="?textAppearanceBodyMedium"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_alignParentStart="true"
                            android:layout_centerVertical="true"
                            android:layout_marginEnd="5sp"
                            android:gravity="center_vertical"
                            android:maxLines="1"
                            android:minHeight="18sp"
                            android:text="@string/me"
                            android:textColor="?colorOnSurfaceVariant"
                            android:visibility="visible" />

                        <LinearLayout
                            android:id="@+id/txt_img_wrapper"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_alignWithParentIfMissing="true"
                            android:layout_centerVertical="true"
                            android:layout_toStartOf="@+id/message_status"
                            android:layout_toEndOf="@id/sender_name"
                            android:orientation="horizontal">

                            <ImageView
                                android:id="@+id/conversation_lastmsg_img"
                                android:layout_width="18sp"
                                android:layout_height="18sp"
                                android:layout_marginEnd="5sp"
                                app:tint="?colorControlNormal" />

                            <TextView
                                android:id="@+id/conversation_lastmsg"
                                style="?textAppearanceBodyMedium"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:ellipsize="end"
                                android:gravity="center_vertical"
                                android:maxLines="1"
                                android:minHeight="18sp"
                                android:scrollHorizontally="false"
                                tools:text="Hi. What’s up?" />
                        </LinearLayout>

                        <ImageView
                            android:id="@+id/message_status"
                            android:layout_width="18sp"
                            android:layout_height="18sp"
                            android:layout_alignWithParentIfMissing="true"
                            android:layout_centerVertical="true"
                            android:layout_marginStart="4dp"
                            android:layout_toStartOf="@+id/notification_status"
                            android:src="@drawable/ic_done_all_24dp"
                            app:tint="?colorPrimary"
                            android:visibility="visible" />

                        <ImageView
                            android:id="@+id/notification_status"
                            android:layout_width="18sp"
                            android:layout_height="18sp"
                            android:layout_alignWithParentIfMissing="true"
                            android:layout_centerVertical="true"
                            android:layout_marginStart="4dp"
                            android:layout_toStartOf="@+id/pinned_on_top"
                            android:src="@drawable/ic_notifications_24dp"
                            android:visibility="visible" />

                        <ImageView
                            android:id="@+id/pinned_on_top"
                            android:layout_width="18sp"
                            android:layout_height="18sp"
                            android:layout_alignWithParentIfMissing="true"
                            android:layout_centerVertical="true"
                            android:layout_marginStart="4dp"
                            android:layout_toStartOf="@+id/unread_count"
                            android:src="@drawable/ic_star_24dp"
                            android:visibility="visible" />

                        <eu.siacs.conversations.ui.widget.UnreadCountCustomView
                            android:id="@+id/unread_count"
                            android:layout_width="18sp"
                            android:layout_height="18sp"
                            android:layout_alignParentEnd="true"
                            android:layout_centerVertical="true"
                            android:layout_marginStart="3dp"
                            android:layout_marginTop="2dp"
                            android:layout_marginBottom="1dp"
                            android:visibility="gone"
                            app:backgroundColor="?colorTertiaryContainer"
                            app:textColor="?colorOnTertiaryContainer" />

                    </RelativeLayout>

                    <TextView
                        android:id="@+id/conversation_lastupdate"
                        style="?textAppearanceBodySmall"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignBaseline="@+id/conversation_name"
                        android:layout_alignParentEnd="true"
                        android:gravity="right"
                        tools:text="23:42" />
                </RelativeLayout>
            </RelativeLayout>
        </FrameLayout>
    </FrameLayout>
</layout>
