<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/mail_list_item"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    tools:background="#fff">

    <!-- A regular View breaks things for some reason, but a TextView does the job -->
    <TextView
        android:id="@+id/chip"
        android:layout_width="8dip"
        android:layout_height="match_parent"
        tools:background="#0099CC"
        android:visibility="visible" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="@dimen/widget_padding">

        <TextView
            android:id="@+id/mail_date"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:layout_marginStart="4dp"
            android:layout_marginLeft="4dp"
            tools:text="25 May" />

        <ImageView
            android:id="@+id/attachment"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/mail_date"
            android:layout_centerInParent="true"
            android:layout_marginStart="4dp"
            android:layout_marginLeft="4dp"
            android:layout_toStartOf="@+id/mail_date"
            android:layout_toLeftOf="@+id/mail_date"
            android:src="@drawable/ic_messagelist_attachment_light"
            android:visibility="gone"
            tools:visibility="visible" />

        <TextView
            android:id="@+id/sender"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentStart="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:layout_gravity="start"
            android:layout_toStartOf="@id/attachment"
            android:layout_toLeftOf="@id/attachment"
            android:ellipsize="end"
            android:maxLines="1"
            android:textSize="16sp"
            tools:text="Kinda long subject that should be long enough to exceed the available display space" />

        <TextView
            android:id="@+id/mail_subject"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/sender"
            android:layout_alignParentStart="true"
            android:layout_alignParentLeft="true"
            android:ellipsize="end"
            android:maxLines="1"
            android:paddingBottom="2dp"
            android:textSize="15sp"
            tools:text="Wikipedia" />

        <TextView
            android:id="@+id/mail_preview"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/mail_subject"
            android:layout_alignParentStart="true"
            android:layout_alignParentLeft="true"
            android:maxLines="1"
            android:textSize="13sp"
            tools:text="Towel Day is celebrated every year on 25 May as a tribute to the author Douglas Adams by his fans." />

    </RelativeLayout>
</LinearLayout>
