<?xml version="1.0" encoding="utf-8"?>
<!--
 Copyright 2019 Jeremy Jamet / Kunzisoft.

 This file is part of KeePassDX.

  KeePassDX is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  KeePassDX is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with KeePassDX.  If not, see <http://www.gnu.org/licenses/>.
-->
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:targetApi="p"
    android:id="@+id/item_attachment_container"
    android:focusable="false"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <androidx.appcompat.widget.AppCompatImageView
        android:id="@+id/item_attachment_thumbnail"
        android:layout_width="match_parent"
        android:layout_height="@dimen/image_preview_height"
        android:layout_marginTop="12dp"
        android:layout_centerHorizontal="true"
        android:visibility="gone"
        android:background="?android:attr/windowBackground"
        android:scaleType="fitStart" />

    <RelativeLayout
        android:id="@+id/item_attachment_info"
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:layout_alignBottom="@+id/item_attachment_thumbnail"
        android:alpha="0.8"
        android:background="?attr/colorSurfaceContainer">

        <androidx.appcompat.widget.AppCompatImageView
            android:id="@+id/item_attachment_broken"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:contentDescription="@string/entry_attachments"
            android:src="@drawable/ic_attach_file_broken_white_24dp" />

        <androidx.appcompat.widget.AppCompatTextView
            android:id="@+id/item_attachment_title"
            style="@style/KeepassDXStyle.TextAppearance.TextNode"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_toStartOf="@+id/item_attachment_size_container"
            android:layout_toLeftOf="@+id/item_attachment_size_container"
            android:layout_toEndOf="@+id/item_attachment_broken"
            android:layout_toRightOf="@+id/item_attachment_broken"
            android:ellipsize="end"
            android:gravity="center_vertical"
            android:maxLines="2"
            tools:text="BinaryFile.attach" />

        <LinearLayout
            android:id="@+id/item_attachment_size_container"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:gravity="center_vertical|end"
            android:orientation="vertical"
            android:layout_toLeftOf="@+id/item_attachment_action_container"
            android:layout_toStartOf="@+id/item_attachment_action_container">

            <androidx.appcompat.widget.AppCompatTextView
                android:id="@+id/item_attachment_size"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:firstBaselineToTopHeight="0dp"
                android:includeFontPadding="false"
                tools:text="1.2 Mb" />

            <androidx.appcompat.widget.AppCompatTextView
                android:id="@+id/item_attachment_compression"
                style="@style/KeepassDXStyle.Text.Tiny"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:firstBaselineToTopHeight="0dp"
                android:includeFontPadding="false"
                android:paddingStart="8dp"
                android:paddingEnd="8dp"
                android:paddingLeft="8dp"
                android:paddingRight="8dp"
                tools:text="GZip" />
        </LinearLayout>

        <FrameLayout
            android:id="@+id/item_attachment_action_container"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true">

            <androidx.appcompat.widget.AppCompatImageButton
                android:id="@+id/item_attachment_delete_button"
                style="@style/KeepassDXStyle.ImageButton.Simple"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:contentDescription="@string/content_description_remove_field"
                android:focusable="true"
                android:src="@drawable/ic_content_delete_white_24dp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <FrameLayout
                android:id="@+id/item_attachment_progress_container"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:focusable="false">

                <androidx.appcompat.widget.AppCompatImageView
                    android:id="@+id/item_attachment_icon"
                    style="@style/KeepassDXStyle.ImageButton.Simple"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:clickable="false"
                    android:contentDescription="@string/download"
                    android:src="@drawable/ic_file_stream_white_24dp"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <com.google.android.material.progressindicator.CircularProgressIndicator
                    android:id="@+id/item_attachment_progress"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:indeterminate="false"
                    app:indicatorSize="36dp"
                    app:trackThickness="2dp"
                    app:indicatorDirectionCircular="clockwise"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />
            </FrameLayout>
        </FrameLayout>
    </RelativeLayout>
</RelativeLayout>