<?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:background="?android:attr/selectableItemBackground"
    android:paddingStart="@dimen/screen_edge_left_and_right_padding"
    android:paddingEnd="@dimen/screen_edge_left_and_right_padding"
    android:paddingTop="@dimen/chat_item_top_and_bottom_padding"
    android:paddingBottom="@dimen/chat_item_top_and_bottom_padding">

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

    <TextView
        android:id="@+id/text_chat_name"
        style="@style/ChatRoom.Name.TextView"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        app:layout_constraintStart_toEndOf="@id/layout_avatar"
        android:textDirection="locale"
        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"
        android:layout_marginEnd="5dp"
        app:layout_constraintBaseline_toBaselineOf="@+id/text_chat_name"
        app:layout_constraintEnd_toEndOf="parent"
        tools:text="11:45 AM" />

    <TextView
        android:id="@+id/text_last_message"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:ellipsize="end"
        android:maxLines="2"
        android:layout_marginTop="2dp"
        app:layout_constraintStart_toStartOf="@id/text_chat_name"
        app:layout_constraintTop_toBottomOf="@id/text_chat_name"
        app:layout_constraintEnd_toStartOf="@id/layout_unread_messages_badge"
        android:textDirection="locale"
        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"
        android:layout_marginEnd="5dp"
        app:layout_constraintTop_toTopOf="@id/text_last_message"
        app:layout_constraintEnd_toEndOf="parent"/>

</android.support.constraint.ConstraintLayout>