<?xml version="1.0" encoding="utf-8"?>
<com.fsck.k9.ui.messageview.AttachmentView 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="wrap_content"
    android:layout_height="wrap_content"
    android:paddingBottom="4dp"
    android:id="@+id/attachment">

    <androidx.cardview.widget.CardView
        android:layout_width="300dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="12dp"
        android:layout_marginEnd="12dp"
        android:layout_marginBottom="12dp"
        android:orientation="vertical"
        android:foreground="?attr/selectableItemBackground"
        app:cardBackgroundColor="?attr/attachmentCardBackground"
        app:cardCornerRadius="2dp"
        app:cardElevation="1dp">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <ImageView
                android:id="@+id/attachment_preview"
                android:layout_width="match_parent"
                android:layout_height="150dp"
                android:background="?android:attr/windowBackground"
                android:contentDescription="@null"
                android:visibility="gone"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                tools:visibility="visible" />

            <ImageView
                android:id="@+id/attachment_type"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="16dp"
                android:layout_marginTop="8dp"
                android:layout_marginBottom="8dp"
                android:contentDescription="@null"
                app:srcCompat="@drawable/ic_attachment_generic"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/attachment_preview"
                app:tint="?attr/colorAccent" />

            <TextView
                android:id="@+id/attachment_name"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginStart="16dp"
                android:layout_marginTop="8dp"
                android:layout_marginEnd="8dp"
                android:ellipsize="start"
                android:singleLine="true"
                android:textColor="?android:attr/textColorPrimary"
                android:textSize="14sp"
                app:layout_constraintBottom_toTopOf="@+id/attachment_size"
                app:layout_constraintEnd_toStartOf="@+id/save_button"
                app:layout_constraintStart_toEndOf="@+id/attachment_type"
                app:layout_constraintTop_toBottomOf="@+id/attachment_preview"
                app:layout_constraintVertical_chainStyle="packed"
                tools:text="filename.ext" />

            <TextView
                android:id="@+id/attachment_size"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginBottom="8dp"
                android:singleLine="true"
                android:textColor="?android:attr/textColorSecondary"
                android:textSize="12sp"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="@+id/attachment_name"
                app:layout_constraintStart_toStartOf="@+id/attachment_name"
                app:layout_constraintTop_toBottomOf="@+id/attachment_name"
                app:layout_constraintVertical_bias="0.0"
                tools:text="99 KB" />

            <ImageButton
                android:id="@+id/save_button"
                android:layout_width="42dp"
                android:layout_height="42dp"
                android:layout_marginTop="8dp"
                android:layout_marginBottom="8dp"
                android:background="?attr/selectableItemBackgroundBorderless"
                android:contentDescription="@string/remove_attachment_action"
                app:srcCompat="?attr/iconActionSave"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/attachment_preview" />

        </androidx.constraintlayout.widget.ConstraintLayout>

    </androidx.cardview.widget.CardView>

</com.fsck.k9.ui.messageview.AttachmentView>
