<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:paddingBottom="20dp"
        android:layout_height="wrap_content">

        <com.google.android.material.card.MaterialCardView
            android:id="@+id/frame_layout"
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:cardCornerRadius="0dp"
            app:layout_constraintDimensionRatio="H,16:9"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">


            <androidx.media3.ui.PlayerView
                android:id="@+id/video_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:keepScreenOn="true"
                app:layout_constraintTop_toTopOf="parent"
                app:resize_mode="fixed_height"
                app:use_controller="true" />

        </com.google.android.material.card.MaterialCardView>

        <com.google.android.material.button.MaterialButton
            android:id="@+id/download_thumb"
            style="@style/Widget.Material3.Button.IconButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:icon="@drawable/ic_image"
            android:contentDescription="@string/save_thumb"
            app:iconSize="30dp"
            app:iconTint="?android:colorAccent"
            app:layout_constraintTop_toTopOf="@+id/frame_layout"
            app:layout_constraintEnd_toEndOf="@+id/frame_layout" />


        <androidx.core.widget.NestedScrollView
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:scrollbars="none"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/frame_layout"
            android:layout_height="wrap_content">


            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/list_section"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:layout_margin="10dp">

                <TextView
                    android:id="@+id/title"
                    android:layout_width="0dp"
                    android:textStyle="bold"
                    android:layout_marginHorizontal="10dp"
                    android:layout_height="wrap_content"
                    android:ellipsize="end"
                    android:maxLines="2"
                    android:singleLine="false"
                    android:text="@string/app_name"
                    android:textSize="17sp"
                    app:layout_constraintEnd_toStartOf="@+id/download_music"
                    app:layout_constraintHorizontal_bias="0.0"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <TextView
                    android:id="@+id/bottom_info"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginHorizontal="10dp"
                    android:ellipsize="end"
                    app:layout_constraintVertical_bias="0.0"
                    android:singleLine="false"
                    android:text="@string/app_name"
                    android:textSize="12sp"
                    app:layout_constraintBottom_toTopOf="@+id/nestedScrollView"
                    app:layout_constraintEnd_toStartOf="@+id/download_music"
                    app:layout_constraintHorizontal_bias="0.0"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/title" />


                <com.google.android.material.button.MaterialButton
                    android:id="@+id/download_music"
                    style="@style/Widget.Material3.ExtendedFloatingActionButton.Icon.Secondary"
                    android:layout_width="55dp"
                    app:elevation="0dp"
                    android:elevation="0dp"
                    app:borderWidth="0dp"
                    android:contentDescription="@string/audio"
                    android:layout_height="55dp"
                    android:layout_marginHorizontal="5dp"
                    app:icon="@drawable/ic_music"
                    app:layout_constraintEnd_toStartOf="@+id/download_video"
                    app:layout_constraintTop_toTopOf="parent" />

                <com.google.android.material.button.MaterialButton
                    android:id="@+id/download_video"
                    style="@style/Widget.Material3.ExtendedFloatingActionButton.Icon.Secondary"
                    android:layout_width="55dp"
                    android:layout_height="55dp"
                    app:elevation="0dp"
                    android:contentDescription="@string/video"
                    android:layout_marginHorizontal="5dp"
                    app:icon="@drawable/ic_video"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <androidx.constraintlayout.widget.Barrier
                    android:id="@+id/title_barrier"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:barrierDirection="bottom"
                    app:constraint_referenced_ids="bottom_info,download_music" />


                <androidx.core.widget.NestedScrollView
                    android:id="@+id/nestedScrollView"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/title_barrier">

                    <androidx.constraintlayout.widget.ConstraintLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">


                        <TextView
                            android:id="@+id/running"
                            android:visibility="gone"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginVertical="10dp"
                            android:layout_marginHorizontal="10dp"
                            android:text="@string/running"
                            android:textStyle="bold"
                            app:layout_constraintStart_toStartOf="parent"
                            app:layout_constraintTop_toTopOf="parent" />

                        <androidx.recyclerview.widget.RecyclerView
                            android:id="@+id/running_recycler"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            app:layout_constraintEnd_toEndOf="parent"
                            app:layout_constraintStart_toStartOf="parent"
                            app:layout_constraintTop_toBottomOf="@id/running" />


                        <TextView
                            android:id="@+id/queued"
                            android:visibility="gone"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginVertical="10dp"
                            android:layout_marginHorizontal="10dp"
                            android:text="@string/download_queue"
                            android:textStyle="bold"
                            app:layout_constraintStart_toStartOf="parent"
                            app:layout_constraintTop_toBottomOf="@id/running_recycler" />


                        <androidx.recyclerview.widget.RecyclerView
                            android:id="@+id/queued_recycler"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            app:layout_constraintEnd_toEndOf="parent"
                            app:layout_constraintStart_toStartOf="parent"
                            app:layout_constraintTop_toBottomOf="@id/queued" />


                        <Button
                            android:id="@+id/bottom_sheet_link"
                            style="@style/Widget.Material3.Button.TextButton.Icon"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="10dp"
                            android:singleLine="true"
                            android:text="@string/app_name"
                            android:textAlignment="textStart"
                            android:textSize="15sp"
                            app:icon="@drawable/ic_link"
                            app:layout_constraintEnd_toEndOf="parent"
                            app:layout_constraintStart_toStartOf="parent"
                            app:layout_constraintTop_toBottomOf="@id/queued_recycler" />


                    </androidx.constraintlayout.widget.ConstraintLayout>

                </androidx.core.widget.NestedScrollView>

            </androidx.constraintlayout.widget.ConstraintLayout>

        </androidx.core.widget.NestedScrollView>
    </androidx.constraintlayout.widget.ConstraintLayout>


</androidx.core.widget.NestedScrollView>
