<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:id="@+id/library_layout"
    android:background="?background"
    android:layout_width="match_parent"
    android:clipChildren="false"
    android:layout_height="match_parent">

    <com.google.android.material.progressindicator.CircularProgressIndicator
        android:id="@+id/progress"
        android:indeterminate="true"
        android:layout_width="75dp"
        android:layout_height="75dp"
        android:layout_gravity="center" />

    <androidx.compose.ui.platform.ComposeView
        android:id="@+id/compose_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone" />

    <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
        android:id="@+id/swipe_refresh"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <FrameLayout
            android:id="@+id/recycler_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <eu.kanade.tachiyomi.ui.library.category.CategoryRecyclerView
                android:id="@+id/category_recycler"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="?actionBarSize"
                android:clipToPadding="false"
                android:visibility="invisible"
                android:paddingBottom="4dp"
                android:scrollbars="vertical" />

            <View
                android:id="@+id/recycler_shadow"
                android:layout_width="match_parent"
                android:layout_height="20dp"
                android:alpha="0.25"
                android:background="@drawable/shape_gradient_top_shadow"
                android:translationY="12dp"
                app:layout_constraintBottom_toTopOf="@id/recycler"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent" />

            <include layout="@layout/library_grid_recycler"
                android:id="@+id/library_grid_recycler"/>

            <View
                android:id="@+id/recycler_cover"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:alpha="0"
                android:background="@drawable/bottom_sheet_rounded_background"
                android:backgroundTint="?attr/background" />
        </FrameLayout>

    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

    <com.google.android.material.card.MaterialCardView
        android:id="@+id/header_card"
        android:layout_marginTop="6dp"
        app:cardCornerRadius="16dp"
        app:cardBackgroundColor="@android:color/transparent"
        app:cardElevation="2dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center|top">

        <TextView
            android:id="@+id/header_title"
            style="?textAppearanceTitleSmall"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/list_item_selector"
            android:backgroundTint="?colorPrimaryVariant"
            android:clickable="true"
            android:ellipsize="end"
            android:focusable="true"
            android:inputType="none"
            android:maxLines="1"
            android:textAlignment="center"
            android:paddingStart="12dp"
            android:paddingEnd="12dp"
            android:paddingTop="4dp"
            android:paddingBottom="4dp"
            android:textColor="?actionBarTintColor"
            android:textSize="14sp"
            tools:text="Category" />
    </com.google.android.material.card.MaterialCardView>

    <eu.kanade.tachiyomi.widget.EmptyView
        android:id="@+id/empty_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:visibility="gone" />

    <com.google.android.material.textview.MaterialTextView
        android:id="@+id/jumper_category_text"
        style="@style/FloatingTextView"
        android:layout_gravity="start|center"
        android:layout_marginBottom="8dp"
        android:alpha="0.0"
        android:gravity="center"
        app:layout_anchor="@id/category_hopper_frame"
        app:layout_anchorGravity="start|center"
        tools:alpha="1"
        tools:text="Category and a long one" />

    <FrameLayout
        android:id="@+id/category_hopper_frame"
        android:layout_width="wrap_content"
        tools:layout_marginBottom="62dp"
        tools:layout_gravity="bottom|end"
        android:layout_height="wrap_content"
        android:clipToPadding="false"
        android:clipChildren="false"
        android:layout_gravity="top|center">

        <include layout="@layout/rounded_category_hopper"
            android:id="@+id/rounded_category_hopper" />

    </FrameLayout>

    <eu.kanade.tachiyomi.ui.library.LibraryFastScroll
        android:id="@+id/fast_scroller"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:fastScrollerBubbleEnabled="true" />

    <!-- Adding bottom sheet after main content -->
    <include layout="@layout/filter_bottom_sheet"
        android:id="@+id/filter_bottom_sheet"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
