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

    <androidx.fragment.app.FragmentContainerView
        android:id="@+id/playerFragment"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="top"
        android:elevation="8dp"
        android:outlineProvider="none"
        android:background="?attr/colorSurfaceContainer"
        tools:layout_height="@dimen/external_player_height" />

    <RelativeLayout
        android:id="@+id/playerContent"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.google.android.material.appbar.MaterialToolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:minHeight="?attr/actionBarSize"
            app:navigationContentDescription="@string/toolbar_back_button_content_description"
            app:navigationIcon="@drawable/ic_arrow_down" />

        <androidx.viewpager2.widget.ViewPager2
            android:id="@+id/pager"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_above="@id/playtime_layout"
            android:layout_below="@id/toolbar"
            android:layout_marginBottom="12dp"
            android:foreground="?android:windowContentOverlay"
            android:orientation="vertical" />

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="8dp"
            android:layout_alignBottom="@id/pager"
            android:importantForAccessibility="no"
            app:srcCompat="@drawable/bg_gradient"
            app:tint="?android:attr/colorBackground" />

        <androidx.cardview.widget.CardView
            android:id="@+id/cardViewSeek"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/pager"
            android:layout_centerHorizontal="true"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_marginBottom="12dp"
            android:alpha="0"
            app:cardBackgroundColor="?attr/seek_background"
            app:cardCornerRadius="8dp"
            app:cardElevation="0dp"
            tools:alpha="1">

            <TextView
                android:id="@+id/txtvSeek"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:paddingLeft="24dp"
                android:paddingTop="4dp"
                android:paddingRight="24dp"
                android:paddingBottom="4dp"
                android:textColor="@color/white"
                android:textSize="16sp"
                tools:text="1:06:29" />

        </androidx.cardview.widget.CardView>

        <LinearLayout
            android:id="@+id/playtime_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layoutDirection="ltr"
            android:orientation="vertical">

            <de.danoeh.antennapod.ui.screen.playback.audio.ChapterSeekBar
                android:id="@+id/sbPosition"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="8dp"
                android:layout_marginRight="8dp"
                android:clickable="true"
                android:max="500"
                tools:progress="100" />

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="4dp"
                android:layout_marginBottom="4dp"
                android:paddingLeft="8dp"
                android:paddingRight="8dp">

                <de.danoeh.antennapod.ui.screen.playback.audio.NoRelayoutTextView
                    android:id="@+id/txtvPosition"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentStart="true"
                    android:layout_alignParentLeft="true"
                    android:layout_marginStart="16dp"
                    android:layout_marginLeft="16dp"
                    android:text="@string/position_default_label"
                    android:textColor="?android:attr/textColorSecondary"
                    android:textSize="@dimen/text_size_micro" />

                <de.danoeh.antennapod.ui.screen.playback.audio.NoRelayoutTextView
                    android:id="@+id/txtvLength"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentEnd="true"
                    android:layout_alignParentRight="true"
                    android:layout_marginEnd="16dp"
                    android:layout_marginRight="16dp"
                    android:textAlignment="textEnd"
                    android:background="?android:attr/selectableItemBackground"
                    android:text="@string/position_default_label"
                    android:textColor="?android:attr/textColorSecondary"
                    android:textSize="@dimen/text_size_micro" />

            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/player_control"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="24dp">

                <de.danoeh.antennapod.ui.screen.playback.PlayButton
                    android:id="@+id/butPlay"
                    android:layout_width="@dimen/audioplayer_playercontrols_length_big"
                    android:layout_height="@dimen/audioplayer_playercontrols_length_big"
                    android:layout_centerHorizontal="true"
                    android:layout_centerVertical="true"
                    android:layout_marginStart="@dimen/audioplayer_playercontrols_margin"
                    android:layout_marginLeft="@dimen/audioplayer_playercontrols_margin"
                    android:layout_marginEnd="@dimen/audioplayer_playercontrols_margin"
                    android:layout_marginRight="@dimen/audioplayer_playercontrols_margin"
                    android:background="?attr/selectableItemBackgroundBorderless"
                    android:contentDescription="@string/pause_label"
                    android:padding="8dp"
                    android:scaleType="fitCenter"
                    app:srcCompat="@drawable/ic_play_48dp"
                    tools:srcCompat="@drawable/ic_play_48dp" />

                <de.danoeh.antennapod.ui.common.CircularProgressBar
                    android:layout_width="@dimen/audioplayer_playercontrols_length_big"
                    android:layout_height="@dimen/audioplayer_playercontrols_length_big"
                    android:layout_centerHorizontal="true"
                    android:layout_centerVertical="true"
                    android:layout_marginStart="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginEnd="16dp"
                    android:layout_marginRight="16dp"
                    app:foregroundColor="?attr/action_icon_color" />

                <ProgressBar
                    android:id="@+id/progLoading"
                    android:layout_width="@dimen/audioplayer_playercontrols_length_big"
                    android:layout_height="@dimen/audioplayer_playercontrols_length_big"
                    android:layout_centerHorizontal="true"
                    android:layout_centerVertical="true"
                    android:visibility="gone"
                    style="?android:attr/progressBarStyle" />

                <ImageButton
                    android:id="@+id/butRev"
                    android:layout_width="@dimen/audioplayer_playercontrols_length"
                    android:layout_height="@dimen/audioplayer_playercontrols_length"
                    android:layout_centerVertical="true"
                    android:layout_marginStart="@dimen/audioplayer_playercontrols_margin"
                    android:layout_marginLeft="@dimen/audioplayer_playercontrols_margin"
                    android:layout_toStartOf="@id/butPlay"
                    android:layout_toLeftOf="@id/butPlay"
                    android:background="?attr/selectableItemBackgroundBorderless"
                    android:contentDescription="@string/rewind_label"
                    android:scaleType="fitCenter"
                    app:srcCompat="@drawable/ic_fast_rewind"
                    tools:srcCompat="@drawable/ic_fast_rewind" />

                <TextView
                    android:id="@+id/txtvRev"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/butRev"
                    android:layout_alignStart="@id/butRev"
                    android:layout_alignLeft="@id/butRev"
                    android:layout_alignEnd="@id/butRev"
                    android:layout_alignRight="@id/butRev"
                    android:clickable="false"
                    android:gravity="center"
                    android:text="30"
                    android:textColor="?android:attr/textColorSecondary"
                    android:textSize="12sp" />

                <ImageButton
                    android:id="@+id/butPlaybackSpeed"
                    android:layout_width="@dimen/audioplayer_playercontrols_length"
                    android:layout_height="@dimen/audioplayer_playercontrols_length"
                    android:padding="8dp"
                    android:layout_centerVertical="true"
                    android:layout_toStartOf="@id/butRev"
                    android:layout_toLeftOf="@id/butRev"
                    android:background="?attr/selectableItemBackgroundBorderless"
                    android:contentDescription="@string/playback_speed"
                    android:scaleType="fitCenter"
                    app:foregroundColor="?attr/action_icon_color"
                    app:srcCompat="@drawable/ic_playback_speed" />

                <TextView
                    android:id="@+id/txtvPlaybackSpeed"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/butPlaybackSpeed"
                    android:layout_alignStart="@id/butPlaybackSpeed"
                    android:layout_alignLeft="@id/butPlaybackSpeed"
                    android:layout_alignEnd="@id/butPlaybackSpeed"
                    android:layout_alignRight="@id/butPlaybackSpeed"
                    android:clickable="false"
                    android:gravity="center"
                    android:text="1.00"
                    android:textColor="?android:attr/textColorSecondary"
                    android:textSize="12sp" />

                <ImageButton
                    android:id="@+id/butFF"
                    android:layout_width="@dimen/audioplayer_playercontrols_length"
                    android:layout_height="@dimen/audioplayer_playercontrols_length"
                    android:layout_centerVertical="true"
                    android:layout_marginEnd="@dimen/audioplayer_playercontrols_margin"
                    android:layout_marginRight="@dimen/audioplayer_playercontrols_margin"
                    android:layout_toEndOf="@id/butPlay"
                    android:layout_toRightOf="@id/butPlay"
                    android:background="?attr/selectableItemBackgroundBorderless"
                    android:contentDescription="@string/fast_forward_label"
                    android:scaleType="fitCenter"
                    app:srcCompat="@drawable/ic_fast_forward"
                    tools:srcCompat="@drawable/ic_fast_forward" />

                <TextView
                    android:id="@+id/txtvFF"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/butFF"
                    android:layout_alignStart="@id/butFF"
                    android:layout_alignLeft="@id/butFF"
                    android:layout_alignEnd="@id/butFF"
                    android:layout_alignRight="@id/butFF"
                    android:clickable="false"
                    android:gravity="center"
                    android:text="30"
                    android:textColor="?android:attr/textColorSecondary"
                    android:textSize="12sp" />

                <ImageButton
                    android:id="@+id/butSkip"
                    android:layout_width="@dimen/audioplayer_playercontrols_length"
                    android:layout_height="@dimen/audioplayer_playercontrols_length"
                    android:layout_centerVertical="true"
                    android:layout_toEndOf="@id/butFF"
                    android:layout_toRightOf="@id/butFF"
                    android:background="?attr/selectableItemBackgroundBorderless"
                    android:contentDescription="@string/skip_episode_label"
                    android:scaleType="fitCenter"
                    app:srcCompat="@drawable/ic_skip_48dp"
                    tools:srcCompat="@drawable/ic_skip_48dp" />

            </RelativeLayout>

        </LinearLayout>

    </RelativeLayout>

</FrameLayout>
