<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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_width="match_parent"
    android:layout_height="match_parent">

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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:ignore="UselessParent">

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

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

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

            <com.kabouzeid.gramophone.views.HeightFitSquareLayout
                android:id="@+id/cover_container"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

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

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

            <com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto"
                android:id="@+id/player_sliding_layout"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_toEndOf="@+id/cover_container"
                android:layout_toRightOf="@+id/cover_container"
                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" />

                    <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" />

                </FrameLayout>

                <FrameLayout
                    android:layout_marginTop="24dp"
                    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="-8dp"
                        android:layout_marginLeft="16dp"
                        android:layout_marginRight="16dp"
                        android:layout_marginTop="0dp"
                        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="48dp" />

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

                                <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>

        </RelativeLayout>

    </LinearLayout>

</FrameLayout>