<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
    android:id="@+id/itemRoomLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?android:colorBackground"
    android:clickable="true"
    android:focusable="true"
    android:foreground="?attr/selectableItemBackground"
    tools:viewBindingIgnore="true">

    <FrameLayout
        android:id="@+id/roomAvatarContainer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginTop="12dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <ImageView
            android:id="@+id/roomAvatarImageView"
            android:layout_width="56dp"
            android:layout_height="56dp"
            android:importantForAccessibility="no"
            android:src="@drawable/placeholder_round_background" />

    </FrameLayout>

    <TextView
        android:id="@+id/roomNameView"
        style="@style/Widget.Vector.TextView.Subtitle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/layout_horizontal_margin"
        android:layout_marginTop="12dp"
        android:layout_marginEnd="70dp"
        android:background="@drawable/placeholder_shape_8"
        android:duplicateParentState="true"
        android:ellipsize="end"
        android:maxLines="1"
        android:textColor="?vctr_content_primary"
        android:textStyle="bold"
        app:layout_constrainedWidth="true"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintHorizontal_chainStyle="packed"
        app:layout_constraintStart_toEndOf="@id/roomAvatarContainer"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/subtitleView"
        style="@style/Widget.Vector.TextView.Body"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="3dp"
        android:layout_marginEnd="8dp"
        android:background="@drawable/placeholder_shape_8"
        android:ellipsize="end"
        android:lines="2"
        android:textAlignment="viewStart"
        android:textColor="?vctr_content_secondary"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="@id/roomNameView"
        app:layout_constraintTop_toBottomOf="@id/roomNameView" />

    <!-- Margin bottom does not work, so I use space -->
    <Space
        android:id="@+id/roomAvatarBottomSpace"
        android:layout_width="0dp"
        android:layout_height="7dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/subtitleView"
        tools:layout_marginStart="120dp" />

    <!-- We use vctr_list_separator_system here for a better rendering -->
    <View
        android:id="@+id/roomDividerView"
        android:layout_width="0dp"
        android:layout_height="1dp"
        android:background="?vctr_list_separator_system"
        app:layout_constraintTop_toBottomOf="@id/roomAvatarBottomSpace"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
