<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
    android:id="@+id/display_bottom_sheet"
    android:animateLayoutChanges="true"
    android:layout_width="match_parent"
    android:background="@drawable/bottom_sheet_rounded_background"
    android:layout_height="match_parent">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/track_recycler"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingTop="5dp"
        android:clipToPadding="false"
        tools:visibility="visible"
        tools:itemCount="3"
        tools:listitem="@layout/track_item" />

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/track_search_constraint_layout"
        android:layout_width="match_parent"
        android:visibility="gone"
        tools:visibility="visible"
        android:layout_height="match_parent">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/title_layout"
            android:layout_width="match_parent"
            android:layout_height="?actionBarSize"
            android:layout_gravity="top"
            android:background="@drawable/bottom_sheet_rounded_background"
            android:backgroundTint="?attr/colorSurface"
            android:clickable="true"
            android:elevation="0dp"
            android:focusable="true"
            app:layout_constraintHorizontal_chainStyle="spread"
            android:orientation="horizontal"
            app:layout_constraintBottom_toTopOf="@id/search_frame_layout"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">

            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/search_toolbar_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:ellipsize="end"
                android:maxLines="1"
                android:text="@string/select_an_entry"
                style="?textAppearanceTitleLarge"
                android:textColor="?actionBarTintColor"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toEndOf="@id/search_close_button"
                app:layout_constraintEnd_toStartOf="@id/guide_button"
                app:layout_constraintTop_toTopOf="parent" />

            <ImageButton
                android:id="@+id/search_close_button"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                app:layout_constraintWidth_max="wrap"
                android:background="?selectableItemBackgroundBorderless"
                android:contentDescription="@string/next_title"
                android:padding="@dimen/material_layout_keylines_screen_edge_margin"
                android:tooltipText="@string/cancel"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:srcCompat="@drawable/ic_close_24dp"
                app:tint="?actionBarTintColor" />

            <ImageButton
                android:id="@+id/guide_button"
                android:visibility="invisible"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                app:layout_constraintWidth_max="wrap"
                android:background="?selectableItemBackgroundBorderless"
                android:contentDescription="@string/next_title"
                android:padding="@dimen/material_layout_keylines_screen_edge_margin"
                android:tooltipText="@string/cancel"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:srcCompat="@drawable/ic_close_24dp"
                app:tint="?actionBarTintColor" />

            <View
                android:id="@+id/divider"
                android:layout_width="match_parent"
                android:layout_height="1dp"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                android:background="@color/divider"/>
        </androidx.constraintlayout.widget.ConstraintLayout>

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/search_frame_layout"
            android:layout_width="match_parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constrainedHeight="true"
            app:layout_constraintTop_toBottomOf="@id/title_layout"
            app:layout_constraintBottom_toTopOf="@id/text_input_layout"
            android:layout_height="wrap_content">
            <com.google.android.material.progressindicator.CircularProgressIndicator
                android:id="@+id/search_progress"
                android:indeterminate="true"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="32dp"
                android:layout_marginBottom="32dp"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintBottom_toBottomOf="parent"
                android:visibility="invisible"
                tools:visibility="invisible" />

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/track_search_recycler"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:layout_constraintHeight_max="1500dp"
                android:nestedScrollingEnabled="false"
                android:clipToPadding="false"
                android:layout_marginTop="4dp"
                android:layout_marginBottom="4dp"
                android:scrollbars="none"
                android:visibility="invisible"
                tools:itemCount="50"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintBottom_toBottomOf="parent"
                tools:listitem="@layout/track_search_item"
                tools:visibility="visible" />

            <eu.kanade.tachiyomi.widget.EmptyView
                android:id="@+id/search_empty_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                android:visibility="gone" />

        </androidx.constraintlayout.widget.ConstraintLayout>

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/text_input_layout"
            style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
            android:layout_width="match_parent"
            app:boxStrokeColor="@color/text_box_stroke_selector"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:layout_marginEnd="16dp"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintTop_toBottomOf="@id/search_frame_layout"
            android:hint="@string/title"
            app:endIconMode="clear_text"
            app:hintEnabled="false"
            app:hintTextColor="?colorSecondary">

            <eu.kanade.tachiyomi.widget.TachiyomiTextInputEditText
                android:id="@+id/track_search"
                android:layout_width="match_parent"
                android:imeOptions="actionSearch"
                android:layout_height="wrap_content"
                android:hint="@string/title"
                android:inputType="text" />

        </com.google.android.material.textfield.TextInputLayout>
    </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
