<?xml version="1.0" encoding="utf-8"?>
<!-- This is a PlayerView controller layout (app:controller_layout_id), so it is bound to
     media3-ui's exo_* ids by contract. The transport buttons reuse media3's own icons and
     descriptions for the same reason; they are marked private, hence the tools:ignore. If a
     media3 upgrade ever drops one, copy it into res/ here rather than un-suppressing. -->
<merge 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">

    <View
        android:id="@id/exo_controls_background"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/transparent" />

    <View
        android:layout_width="720dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@drawable/player_osd_left_gradient" />

    <View
        android:layout_width="match_parent"
        android:layout_height="230dp"
        android:layout_gravity="bottom"
        android:background="@drawable/player_osd_bottom_gradient" />

    <!-- Pause is a deliberate browsing moment, rather than just the ordinary OSD frozen
         over a frame. It carries the movie context while the transport row below remains
         the single, familiar place to resume or seek. -->
    <include layout="@layout/player_pause_overlay" />

    <LinearLayout
        android:id="@+id/player_now_playing_group"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="top|start"
        android:layout_marginStart="48dp"
        android:layout_marginTop="30dp"
        android:clipChildren="false"
        android:clipToPadding="false"
        android:orientation="vertical">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:letterSpacing="0.14"
            android:text="@string/player_now_playing"
            android:textColor="#B8FFFFFF"
            android:textSize="11sp" />

        <ImageView
            android:id="@+id/player_title_logo"
            android:layout_width="320dp"
            android:layout_height="92dp"
            android:layout_marginTop="7dp"
            android:adjustViewBounds="true"
            android:contentDescription="@string/player_title_logo"
            android:scaleType="fitStart"
            android:visibility="invisible" />

        <TextView
            android:id="@+id/player_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:ellipsize="end"
            android:maxLines="2"
            android:maxWidth="600dp"
            android:includeFontPadding="true"
            android:lineSpacingExtra="2dp"
            android:textColor="#FFFFFFFF"
            android:textSize="28sp"
            android:textStyle="bold"
            android:visibility="gone" />
    </LinearLayout>

    <TextView
        android:id="@+id/player_stream_status"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="top|end"
        android:layout_marginTop="44dp"
        android:layout_marginEnd="48dp"
        android:background="@drawable/player_status_background"
        android:letterSpacing="0.08"
        android:paddingStart="13dp"
        android:paddingTop="7dp"
        android:paddingEnd="13dp"
        android:paddingBottom="7dp"
        android:textColor="#DFFFFFFF"
        android:textSize="11sp"
        android:visibility="gone" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="210dp"
        android:layout_gravity="bottom"
        android:gravity="bottom"
        android:orientation="vertical"
        android:paddingStart="48dp"
        android:paddingEnd="48dp"
        android:paddingBottom="28dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_vertical"
            android:orientation="horizontal">

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="center_vertical"
                android:orientation="horizontal">

                <TextView
                    android:id="@id/exo_position"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="#FFFFFFFF"
                    android:textSize="15sp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingStart="6dp"
                    android:paddingEnd="6dp"
                    android:text="@string/player_position_separator"
                    android:textColor="#80FFFFFF"
                    android:textSize="14sp" />

                <TextView
                    android:id="@id/exo_duration"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="#AFFFFFFF"
                    android:textSize="14sp" />

                <TextView
                    android:id="@+id/player_remaining"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="16dp"
                    android:text="@string/player_loading_duration"
                    android:textColor="#BFFFFFFF"
                    android:textSize="13sp" />
            </LinearLayout>

            <TextView
                android:id="@+id/player_finish_time"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#FFFFFFFF"
                android:textSize="14sp" />
        </LinearLayout>

        <androidx.media3.ui.DefaultTimeBar
            android:id="@id/exo_progress"
            android:layout_width="match_parent"
            android:layout_height="34dp"
            android:focusable="true"
            app:ad_marker_color="#80FFFFFF"
            app:bar_height="4dp"
            app:buffered_color="#70FFFFFF"
            app:played_ad_marker_color="#FFFFFFFF"
            app:played_color="#FF52B54B"
            app:scrubber_color="#FFFFFFFF"
            app:scrubber_dragged_size="18dp"
            app:scrubber_enabled_size="14dp"
            app:touch_target_height="28dp"
            app:unplayed_color="#40FFFFFF" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="72dp"
            android:focusable="false">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_gravity="start|center_vertical"
                android:gravity="center_vertical"
                android:orientation="horizontal">

                <ImageButton
                    android:id="@+id/player_exit"
                    style="@style/MembyPlayerControlButton"
                    android:contentDescription="@string/player_back"
                    android:src="@drawable/ic_player_back" />

                <ImageButton
                    android:id="@+id/player_hide_controls"
                    style="@style/MembyPlayerControlButton"
                    android:contentDescription="@string/player_hide_controls"
                    android:src="@drawable/ic_player_hide" />
            </LinearLayout>

            <LinearLayout
                android:id="@id/exo_center_controls"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:gravity="center"
                android:orientation="horizontal">

                <ImageButton
                    android:id="@id/exo_rew"
                    style="@style/MembyPlayerControlButton"
                    android:contentDescription="@string/exo_controls_rewind_description"
                    android:src="@drawable/exo_icon_rewind"
                    tools:ignore="PrivateResource" />

                <ImageButton
                    android:id="@id/exo_play_pause"
                    style="@style/MembyPlayerPrimaryControlButton"
                    android:contentDescription="@string/exo_controls_play_description"
                    android:focusedByDefault="true"
                    android:src="@drawable/exo_icon_play"
                    tools:ignore="PrivateResource,UnusedAttribute" />

                <ImageButton
                    android:id="@id/exo_ffwd"
                    style="@style/MembyPlayerControlButton"
                    android:contentDescription="@string/exo_controls_fastforward_description"
                    android:src="@drawable/exo_icon_fastforward"
                    tools:ignore="PrivateResource" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_gravity="end|center_vertical"
                android:gravity="center_vertical"
                android:orientation="horizontal">

                <ImageButton
                    android:id="@id/exo_subtitle"
                    style="@style/MembyPlayerControlButton"
                    android:contentDescription="@string/exo_controls_cc_enabled_description"
                    android:src="@drawable/exo_ic_subtitle_on"
                    tools:ignore="PrivateResource" />

                <!-- Beside the subtitle picker rather than buried in the settings list:
                     "who is this?" is asked mid-scene, and a question that has to survive a
                     dialog and four menu rows is one nobody asks twice. -->
                <ImageButton
                    android:id="@+id/player_cast"
                    style="@style/MembyPlayerControlButton"
                    android:contentDescription="@string/player_cast_open"
                    android:src="@drawable/ic_player_cast" />

                <ImageButton
                    android:id="@id/exo_settings"
                    style="@style/MembyPlayerControlButton"
                    android:contentDescription="@string/exo_controls_settings_description"
                    android:src="@drawable/exo_ic_settings"
                    tools:ignore="PrivateResource" />
            </LinearLayout>
        </FrameLayout>
    </LinearLayout>

    <!-- The frame the scrubber is sitting on, while the transport is up and Left/Right
         belong to the time bar rather than to us. Declared last so it draws over the OSD
         gradients, and positioned horizontally from code so it rides above the scrubber
         instead of naming a place on screen the scrubber may not be.

         There is no wording beside it, unlike the centred chip: the transport is already
         printing the position it would say, and a second copy of it over somebody's film
         is a caption on a caption. The bottom margin clears the button row (72dp), its
         padding (28dp) and the bar itself (34dp), with a gap above that. -->
    <ImageView
        android:id="@+id/player_scrub_preview"
        android:layout_width="214dp"
        android:layout_height="120dp"
        android:layout_gravity="bottom|start"
        android:layout_marginBottom="146dp"
        android:background="@drawable/player_scrub_preview_background"
        android:contentDescription="@null"
        android:focusable="false"
        android:scaleType="fitCenter"
        android:visibility="gone" />

</merge>
