<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!--The unused FrameLayout layout is necessary to prevent a crash on rotate-->

    <com.sothree.slidinguppanel.SlidingUpPanelLayout android:id="@+id/player_sliding_layout"
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/tools"
        xmlns:sothree="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clickable="false"
        android:focusable="true"
        android:gravity="bottom"
        sothree:umanoFadeColor="#00000000"
        sothree:umanoOverlay="true"
        sothree:umanoPanelHeight="0dp"
        sothree:umanoScrollableView="@+id/player_recycler_view"
        sothree:umanoShadowHeight="0dp">

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <View
                android:id="@+id/color_background"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

            <RelativeLayout
                android:id="@+id/player_content"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <com.kabouzeid.gramophone.views.WidthFitSquareLayout
                    android:id="@+id/album_cover_container"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentTop="true">

                    <fragment
                        android:id="@+id/player_album_cover_fragment"
                        class="com.kabouzeid.gramophone.ui.fragments.player.PlayerAlbumCoverFragment"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content" />

                </com.kabouzeid.gramophone.views.WidthFitSquareLayout>

                <fragment
                    android:id="@+id/playback_controls_fragment"
                    class="com.kabouzeid.gramophone.ui.fragments.player.card.CardPlayerPlaybackControlsFragment"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/album_cover_container" />

            </RelativeLayout>

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

            <android.support.v7.widget.Toolbar
                android:id="@+id/player_toolbar"
                style="@style/Toolbar"
                android:layout_marginTop="@dimen/status_bar_padding"
                android:background="@android:color/transparent" />

        </FrameLayout>

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

            <android.support.v7.widget.CardView
                android:id="@+id/playing_queue_card"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="16dp"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginTop="@dimen/status_bar_padding"
                app:cardBackgroundColor="?cardBackgroundColor"
                app:cardElevation="@dimen/card_elevation"
                app:cardUseCompatPadding="false">

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <!--This is necessary for the drag sorting to work at the top-->
                    <View
                        android:id="@+id/draggable_area"
                        android:layout_width="72dp"
                        android:layout_height="wrap_content"
                        android:layout_alignBottom="@+id/card_content"
                        android:layout_alignTop="@+id/card_content"
                        android:layout_marginTop="120dp" />

                    <LinearLayout
                        android:id="@+id/card_content"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical">

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

                        <TextView
                            android:id="@+id/player_queue_sub_header"
                            android:layout_width="match_parent"
                            android:layout_height="48dp"
                            android:gravity="center_vertical"
                            android:paddingLeft="16dp"
                            android:paddingRight="16dp"
                            android:text="@string/up_next"
                            android:textAppearance="@style/TextAppearance.AppCompat.Body2"
                            android:textColor="?android:textColorSecondary" />

                        <android.support.v7.widget.RecyclerView
                            android:id="@+id/player_recycler_view"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:paddingBottom="8dp"
                            android:requiresFadingEdge="vertical" />

                    </LinearLayout>

                </RelativeLayout>

            </android.support.v7.widget.CardView>

        </FrameLayout>

    </com.sothree.slidinguppanel.SlidingUpPanelLayout>
</FrameLayout>
