<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="12dp"
    android:layout_marginEnd="@dimen/screen_edge_left_and_right_margins"
    android:layout_marginStart="@dimen/screen_edge_left_and_right_margins"
    android:layout_marginTop="12dp">

    <include
        android:id="@+id/layout_avatar"
        layout="@layout/avatar"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_marginTop="6dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <android.support.constraint.ConstraintLayout
        android:id="@+id/top_container"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        app:layout_constraintLeft_toRightOf="@+id/layout_avatar"
        app:layout_constraintRight_toRightOf="parent">

        <TextView
            android:id="@+id/text_chat_name"
            style="@style/ChatRoom.Name.TextView"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toLeftOf="@+id/text_last_message_date_time"
            app:layout_constraintTop_toTopOf="parent"
            tools:text="General" />

        <TextView
            android:id="@+id/text_last_message_date_time"
            style="@style/Timestamp.TextView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="5dp"
            app:layout_constraintBaseline_toBaselineOf="@+id/text_chat_name"
            app:layout_constraintLeft_toRightOf="@+id/text_chat_name"
            app:layout_constraintRight_toRightOf="parent"
            tools:text="11:45 AM" />
    </android.support.constraint.ConstraintLayout>

    <android.support.constraint.ConstraintLayout
        android:id="@+id/bottom_container"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="2dp"
        app:layout_constraintLeft_toRightOf="@+id/layout_avatar"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/top_container">

        <TextView
            android:id="@+id/text_last_message"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:ellipsize="end"
            android:maxLines="2"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toLeftOf="@+id/layout_unread_messages_badge"
            app:layout_constraintTop_toTopOf="parent"
            tools:text="You: Type something" />

        <include
            android:id="@+id/layout_unread_messages_badge"
            layout="@layout/unread_messages_badge"
            android:layout_width="18dp"
            android:layout_height="18dp"
            android:layout_marginStart="5dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintLeft_toRightOf="@+id/text_last_message"
            app:layout_constraintRight_toRightOf="parent" />
    </android.support.constraint.ConstraintLayout>

</android.support.constraint.ConstraintLayout>