<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingHorizontal="8dp"
        android:paddingVertical="4dp">

        <com.makeramen.roundedimageview.RoundedImageView
            android:id="@+id/message_photo"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_alignParentStart="true"
            android:layout_alignParentTop="true"
            android:layout_marginEnd="6dp"
            android:scaleType="fitXY"
            app:riv_corner_radius="6dp" />

        <LinearLayout
            android:id="@+id/message_box"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_toEndOf="@+id/message_photo"
            android:background="@drawable/background_message_bubble"
            android:backgroundTint="?colorTertiaryContainer"
            android:longClickable="true"
            android:minHeight="53dp"
            android:paddingHorizontal="8dp"
            android:paddingVertical="4dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:gravity="center_vertical"
                android:orientation="vertical">

                <include
                    android:id="@+id/message_content"
                    layout="@layout/item_message_content" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="start"
                    android:orientation="horizontal"
                    android:paddingBottom="2dp">

                    <TextView
                        android:id="@+id/message_encryption"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_vertical"
                        android:layout_marginEnd="4sp"
                        android:gravity="center_vertical"
                        android:textAppearance="?textAppearanceBodySmall"
                        android:textColor="?colorOnTertiaryContainer" />

                    <ImageView
                        android:id="@+id/security_indicator"
                        android:layout_width="12sp"
                        android:layout_height="12sp"
                        android:layout_gravity="center_vertical"
                        android:layout_marginEnd="4sp"
                        android:gravity="center_vertical"
                        android:src="@drawable/ic_lock_24dp"
                        app:tint="?colorOnTertiaryContainer" />

                    <ImageView
                        android:id="@+id/edit_indicator"
                        android:layout_width="12sp"
                        android:layout_height="12sp"
                        android:layout_gravity="center_vertical"
                        android:layout_marginEnd="4sp"
                        android:gravity="center_vertical"
                        android:src="@drawable/ic_edit_24dp"
                        app:tint="?colorOnTertiaryContainer" />

                    <TextView
                        android:id="@+id/message_time"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_vertical"
                        android:accessibilityTraversalAfter="@id/message_photo"
                        android:accessibilityTraversalBefore="@id/message_content"
                        android:gravity="center_vertical"
                        android:text="@string/sending"
                        android:textAppearance="?textAppearanceBodySmall"
                        android:textColor="?colorOnTertiaryContainer" />
                </LinearLayout>
            </LinearLayout>
        </LinearLayout>
    </RelativeLayout>
</layout>