<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2025 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/attachment_background"
        android:layout_width="wrap_content"
        android:layout_height="@dimen/fusebox_attachment_item_height"
        android:layout_marginEnd="@dimen/fusebox_attachment_close_overhang"
        android:background="@drawable/inset_navattach_item_background"
        android:clipToOutline="true">

        <ProgressBar
            android:id="@+id/attachment_spinner"
            android:layout_width="@dimen/fusebox_attachment_spinner_size"
            android:layout_height="@dimen/fusebox_attachment_spinner_size"
            android:indeterminate="true"
            android:indeterminateTint="@macro/circular_progress_icon_color_small_large"
            android:visibility="gone"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <ImageView
            android:id="@+id/attachment_thumbnail"
            android:layout_width="@dimen/omnibox_suggestion_24dp_icon_size"
            android:layout_height="@dimen/omnibox_suggestion_24dp_icon_size"
            android:layout_marginStart="@dimen/fusebox_attachment_thumbnail_padding"
            android:layout_marginEnd="@dimen/fusebox_attachment_thumbnail_padding"
            android:clipToOutline="true"
            android:importantForAccessibility="no"
            android:scaleType="centerCrop"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@id/attachment_title"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/attachment_title"
            android:layout_width="wrap_content"
            android:minWidth="@dimen/fusebox_attachment_title_min_width"
            android:maxWidth="@dimen/fusebox_attachment_title_max_width"
            android:layout_height="@dimen/fusebox_attachment_visible_height"
            android:layout_marginEnd="41dp"
            android:ellipsize="end"
            android:gravity="center_vertical"
            android:maxLines="1"
            android:textAppearance="@style/TextAppearance.TextMediumThick.Primary"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toEndOf="@id/attachment_thumbnail"
            app:layout_constraintTop_toTopOf="parent" />

    </androidx.constraintlayout.widget.ConstraintLayout>

    <ImageButton
        android:id="@+id/attachment_remove_button"
        android:layout_width="@dimen/fusebox_attachment_remove_width"
        android:layout_height="@dimen/fusebox_attachment_item_height"
        android:layout_gravity="end"
        android:padding="@dimen/fusebox_attachment_close_padding"
        android:foreground="@drawable/remove_button_focus_ring"
        android:background="?attr/selectableItemBackgroundBorderless"
        android:contentDescription="@string/acc_remove_attachment"
        android:scaleType="fitCenter"
        android:src="@drawable/btn_close"
        app:tint="@color/default_icon_color_secondary_baseline" />

</FrameLayout>