<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/historycoordinator"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/history_appbarlayout"
        app:liftOnScroll="true"
        android:background="@android:color/transparent"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <com.google.android.material.appbar.MaterialToolbar
            android:id="@+id/history_toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_scrollFlags="scroll|enterAlways|snap"
            app:title="@string/downloads"
            app:menu="@menu/history_menu"
            android:theme="@style/Toolbar"
            />

    </com.google.android.material.appbar.AppBarLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:layout_margin="10dp"
        app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">

        <HorizontalScrollView
            android:id="@+id/chips_recycler_horizontalscrollview"
            android:layout_width="wrap_content"
            android:scrollbars="none"
            android:layout_height="wrap_content">

            <LinearLayout
                android:id="@+id/history_selection_chips"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">

                <com.google.android.material.chip.ChipGroup
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:selectionRequired="false"
                    app:singleSelection="false">

                    <com.google.android.material.chip.Chip
                        android:id="@+id/sortChip"
                        style="@style/Widget.Material3.Chip.Assist"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:onClick="sortBy"
                        android:text="@string/sort_by"
                        app:chipIcon="@drawable/ic_down" />

                </com.google.android.material.chip.ChipGroup>

                <View style="@style/Divider.Vertical"/>

                <com.google.android.material.chip.ChipGroup
                    android:id="@+id/format_chip_group"
                    android:layout_width="wrap_content"
                    app:selectionRequired="false"
                    app:singleSelection="true"
                    android:layout_height="wrap_content">

                    <com.google.android.material.chip.Chip
                        android:id="@+id/audio_chip"
                        style="@style/Widget.Material3.Chip.Filter"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/audio"/>

                    <com.google.android.material.chip.Chip
                        android:id="@+id/video_chip"
                        style="@style/Widget.Material3.Chip.Filter"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/video"/>

                </com.google.android.material.chip.ChipGroup>

                <View style="@style/Divider.Vertical"/>

                <com.google.android.material.chip.ChipGroup
                    android:id="@+id/website_chip_group"
                    app:selectionRequired="false"
                    app:singleSelection="true"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content">

                </com.google.android.material.chip.ChipGroup>

            </LinearLayout>

        </HorizontalScrollView>

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recyclerviewhistorys"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/chips_recycler_horizontalscrollview"
            android:clipToPadding="false"
            android:nestedScrollingEnabled="false"
            android:orientation="vertical"
            android:paddingBottom="150dp"
            android:scrollbars="vertical"
            app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager">

        </androidx.recyclerview.widget.RecyclerView>

        <com.facebook.shimmer.ShimmerFrameLayout
            android:layout_width="match_parent"
            android:visibility="gone"
            android:layout_height="match_parent"
            android:layout_below="@+id/chips_recycler_horizontalscrollview"
            android:id="@+id/shimmer_history_framelayout"
            android:orientation="vertical">


            <LinearLayout
                android:id="@+id/shimmer_history_linear_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="10dp"
                android:orientation="vertical">

                <include layout="@layout/history_card_shimmer" />

                <include layout="@layout/history_card_shimmer" />

                <include layout="@layout/history_card_shimmer" />

                <include layout="@layout/history_card_shimmer" />

                <include layout="@layout/history_card_shimmer" />

                <include layout="@layout/history_card_shimmer" />

                <include layout="@layout/history_card_shimmer" />

                <include layout="@layout/history_card_shimmer" />

                <include layout="@layout/history_card_shimmer" />

                <include layout="@layout/history_card_shimmer" />




            </LinearLayout>

        </com.facebook.shimmer.ShimmerFrameLayout>

    </RelativeLayout>


    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:id="@+id/delete_selected_coordinator"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
            android:id="@+id/delete_selected_fab"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="16dp"
            android:visibility="gone"
            android:layout_gravity="bottom|end"
            android:text="@string/delete_selected"
            app:icon="@drawable/ic_delete_all"/>

    </androidx.coordinatorlayout.widget.CoordinatorLayout>


    <include layout="@layout/history_no_results"
        android:visibility="gone" />


    <include layout="@layout/history_item_details_bottom_sheet"
        android:visibility="gone" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>