<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_height="match_parent"
    android:background="@color/black"
    android:fillViewport="true"
    android:id="@+id/root_layout"
    android:layout_width="match_parent"  >
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".ui.activity.PlayActivity">

        <View
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/black_gradient" />

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/content_layout"
            android:layout_width="match_parent"
            android:paddingBottom="20dp"
            android:layout_height="match_parent">

            <ImageView
                android:id="@+id/im_back"
                android:layout_width="42dp"
                android:layout_height="42dp"
                android:layout_marginStart="16dp"
                android:layout_marginTop="35dp"
                android:padding="9dp"
                android:src="@drawable/arrow_bottom"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toTopOf="parent" />


            <androidx.cardview.widget.CardView
                android:id="@+id/card_playerView"
                android:layout_width="match_parent"
                android:layout_height="300dp"
                android:layout_marginStart="20dp"
                android:layout_marginTop="30dp"
                android:layout_marginEnd="20dp"
                app:cardBackgroundColor="@color/black"
                app:cardCornerRadius="8dp"
                app:cardElevation="0dp"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintTop_toBottomOf="@id/im_back">

                <androidx.media3.ui.PlayerView
                    android:id="@+id/player_view"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    app:resize_mode="zoom"
                    app:show_buffering="when_playing"
                    app:show_shuffle_button="false"
                    app:use_controller="false" />

                <ImageView
                    android:id="@+id/im_covert"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:scaleType="centerCrop"
                    android:src="@mipmap/ic_launcher"
                    android:visibility="gone"
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/im_back" />
            </androidx.cardview.widget.CardView>


            <ProgressBar
                android:id="@+id/progressBarLoading"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:indeterminateTint="@color/white"
                android:visibility="gone"
                app:layout_constraintBottom_toBottomOf="@id/card_playerView"
                app:layout_constraintLeft_toLeftOf="@id/card_playerView"
                app:layout_constraintRight_toRightOf="@id/card_playerView"
                app:layout_constraintTop_toTopOf="@id/card_playerView" />

            <include
                android:id="@+id/layout_error"
                layout="@layout/layout_error"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:layout_constraintBottom_toBottomOf="@id/card_playerView"
                app:layout_constraintLeft_toLeftOf="@id/card_playerView"
                app:layout_constraintRight_toRightOf="@id/card_playerView"
                app:layout_constraintTop_toTopOf="@id/card_playerView" />

            <TextView
                android:id="@+id/tv_song_name"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginStart="10dp"
                android:layout_marginTop="25dp"
                android:text=""
                android:textColor="@color/text_color_1"
                android:textSize="19sp"
                app:layout_constraintLeft_toLeftOf="@id/card_playerView"
                app:layout_constraintRight_toRightOf="@id/card_playerView"
                app:layout_constraintTop_toBottomOf="@id/card_playerView" />

            <TextView
                android:id="@+id/tv_singer_name"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="7dp"
                android:text=""
                android:textColor="@color/white_60_color"
                android:textSize="15sp"
                app:layout_constraintRight_toRightOf="@id/tv_song_name"
                app:layout_constraintLeft_toLeftOf="@id/tv_song_name"
                app:layout_constraintTop_toBottomOf="@id/tv_song_name" />

            <LinearLayout
                android:id="@+id/layout_like"
                android:layout_width="wrap_content"
                android:layout_height="34dp"
                android:layout_marginTop="14dp"
                android:background="@drawable/bg_like_layout"
                android:gravity="center_vertical"
                android:orientation="horizontal"
                android:paddingStart="22dp"
                android:paddingEnd="22dp"
                app:layout_constraintLeft_toLeftOf="@id/card_playerView"
                app:layout_constraintTop_toBottomOf="@id/tv_singer_name">

                <ImageView
                    android:id="@+id/im_like"
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                    android:src="@drawable/selector_like" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="12dp"
                    android:text="@string/like"
                    android:textColor="@color/white"
                    android:textSize="14sp" />
            </LinearLayout>


            <RelativeLayout
                android:id="@+id/layout_download"
                android:layout_width="wrap_content"
                android:layout_height="34dp"
                android:layout_marginStart="12dp"
                android:background="@drawable/bg_like_layout"
                android:orientation="horizontal"
                android:paddingStart="22dp"
                android:paddingEnd="22dp"
                app:layout_constraintLeft_toRightOf="@id/layout_like"
                app:layout_constraintTop_toTopOf="@id/layout_like">

                <ImageView
                    android:id="@+id/im_download"
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                    android:layout_centerVertical="true"
                    android:src="@drawable/selector_download" />

                <ProgressBar
                    android:id="@+id/download_pb"
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                    android:layout_centerVertical="true"
                    android:indeterminateTint="@color/panel_bg"
                    android:progressBackgroundTint="@color/panel_bg"
                    android:progressTint="@color/panel_bg"
                    android:visibility="gone" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_marginStart="12dp"
                    android:layout_toEndOf="@id/im_download"
                    android:text="@string/download"
                    android:textColor="@color/white"
                    android:textSize="14sp" />
            </RelativeLayout>

            <SeekBar
                android:id="@+id/play_progress"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="25dp"
                android:maxHeight="3dp"
                android:paddingStart="5dp"
                android:paddingLeft="0dp"
                android:paddingEnd="5dp"
                android:paddingRight="0dp"
                android:progress="3"
                android:progressDrawable="@drawable/seekbar_progress_drawable"
                android:thumb="@drawable/seekbar_thumb"
                app:layout_constraintLeft_toLeftOf="@id/card_playerView"
                app:layout_constraintRight_toRightOf="@id/card_playerView"
                app:layout_constraintTop_toBottomOf="@id/layout_like" />


            <ProgressBar
                android:id="@+id/progressBar_buffer"
                style="?android:attr/progressBarStyleHorizontal"
                android:layout_width="0dp"
                android:layout_height="3dp"
                android:paddingStart="5dp"
                android:paddingEnd="5dp"
                android:progress="10"
                android:progressDrawable="@drawable/horizontal_progressbar"
                app:layout_constraintBottom_toBottomOf="@id/play_progress"
                app:layout_constraintLeft_toLeftOf="@id/play_progress"
                app:layout_constraintRight_toRightOf="@id/play_progress"
                app:layout_constraintTop_toTopOf="@id/play_progress" />

            <TextView
                android:id="@+id/tv_current"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:paddingStart="5dp"
                android:text="0:00"
                android:textColor="@color/white_60_color"
                app:layout_constraintStart_toStartOf="@id/play_progress"
                app:layout_constraintTop_toBottomOf="@id/play_progress" />

            <TextView
                android:id="@+id/tv_duration"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:paddingEnd="5dp"
                android:text="0:00"
                android:textColor="@color/white_60_color"
                app:layout_constraintEnd_toEndOf="@id/play_progress"
                app:layout_constraintTop_toBottomOf="@id/play_progress" />

            <ImageView
                android:id="@+id/btn_play"
                android:layout_width="66dp"
                android:layout_height="66dp"
                android:layout_marginTop="15dp"
                android:layout_marginBottom="10dp"
                android:src="@drawable/selector_icon_play"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintTop_toBottomOf="@id/tv_duration" />

            <ImageView
                android:id="@+id/btn_previous"
                android:layout_width="45dp"
                android:layout_height="45dp"
                android:layout_marginEnd="24dp"
                android:padding="12dp"
                android:src="@mipmap/icon_previous_true"
                app:layout_constraintBottom_toBottomOf="@id/btn_play"
                app:layout_constraintEnd_toStartOf="@id/btn_play"
                app:layout_constraintTop_toTopOf="@id/btn_play" />


            <ImageView
                android:id="@+id/btn_next"
                android:layout_width="45dp"
                android:layout_height="45dp"
                android:layout_marginStart="24dp"
                android:padding="12dp"
                android:src="@mipmap/icon_next_true"
                app:layout_constraintBottom_toBottomOf="@id/btn_play"
                app:layout_constraintStart_toEndOf="@id/btn_play"
                app:layout_constraintTop_toTopOf="@id/btn_play" />

            <ImageView
                android:id="@+id/btn_music_list"
                android:layout_width="44dp"
                android:layout_height="44dp"
                android:padding="10dp"
                android:src="@mipmap/icon_list"
                app:layout_constraintBottom_toBottomOf="@id/btn_play"
                app:layout_constraintLeft_toRightOf="@id/btn_next"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintTop_toTopOf="@id/btn_play" />


            <ImageView
                android:id="@+id/btn_loop"
                android:layout_width="44dp"
                android:layout_height="44dp"
                android:padding="10dp"
                android:src="@drawable/icon_looper_no"
                app:layout_constraintBottom_toBottomOf="@id/btn_play"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintRight_toLeftOf="@id/btn_previous"
                app:layout_constraintTop_toTopOf="@id/btn_play" />

        </androidx.constraintlayout.widget.ConstraintLayout>

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


    </FrameLayout>
</androidx.core.widget.NestedScrollView>