<?xml version="1.0" encoding="utf-8"?>
<!-- The closing credits, moved aside.

     From the `CreditsStart` marker Emby writes into the chapter list, the picture is scaled
     into the left half of the screen and run at double speed while this panel says what is
     on next. The transform is the *activity's* — the same scale-and-translate the next-up
     banner has always used on the PlayerView, deliberately not the pre-roll's reparenting,
     because moving a SurfaceView between parents mid-playback tears the surface down and
     flashes black. The pre-roll can afford that; a running credit roll cannot.

     So the left half of this layout is empty on purpose: it is a hole for the picture that
     is already there to show through.

     There is no scrim and no card behind the picture. It sits on somebody's film, and the
     only lit surface is the button under focus. -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/player_end_credits"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:focusable="false"
    android:visibility="gone">

    <!-- Why the picture is running fast. Without it a viewer who looks up mid-roll has a
         sped-up image and no stated reason for it, which reads as the stream misbehaving.
         It sits under the picture's left half rather than in the panel, because it is a
         label on the video and not part of what is on next.

         The start margin is aligned with the shrunken picture's own left edge, which
         CREDITS_VIDEO_SCALE and CREDITS_VIDEO_SHIFT_X put at ~34dp on a 16:9 set, so it reads
         as a caption on the credits rather than as something floating in the black beside
         them. The bottom margin is the seek chip's, for the same reason: it is the height
         this app already puts a chip at. -->
    <TextView
        android:id="@+id/player_end_credits_speed"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|start"
        android:layout_marginStart="34dp"
        android:layout_marginBottom="104dp"
        android:background="@drawable/time_remaining_cue_background"
        android:letterSpacing="0.06"
        android:paddingStart="14dp"
        android:paddingTop="7dp"
        android:paddingEnd="14dp"
        android:paddingBottom="7dp"
        android:textColor="#FF69CD61"
        android:textSize="14sp"
        android:textStyle="bold"
        tools:text="2×" />

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

        <!-- The hole the picture occupies. Weighted rather than fixed so the split is half
             the screen on every set, whatever its width. -->
        <Space
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1" />

        <LinearLayout
            android:id="@+id/player_end_credits_panel"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center_vertical"
            android:orientation="vertical"
            android:paddingStart="30dp"
            android:paddingEnd="72dp">

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

            <ImageView
                android:id="@+id/player_end_credits_image"
                android:layout_width="match_parent"
                android:layout_height="196dp"
                android:layout_marginTop="14dp"
                android:background="#FF1B2026"
                android:contentDescription="@null"
                android:scaleType="centerCrop" />

            <TextView
                android:id="@+id/player_end_credits_title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:ellipsize="end"
                android:maxLines="2"
                android:textColor="#FFFFFFFF"
                android:textSize="26sp"
                android:textStyle="bold"
                tools:text="The Crossing" />

            <TextView
                android:id="@+id/player_end_credits_meta"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="4dp"
                android:ellipsize="end"
                android:maxLines="1"
                android:textColor="#BFFFFFFF"
                android:textSize="13sp"
                tools:text="S02E05 · Northbound" />

            <!-- Gone rather than blank until the last minute. The pane opens minutes before
                 the file ends, and a countdown that sat there reading "starting in 4:12"
                 would be the most prominent thing on it for most of its life. -->
            <TextView
                android:id="@+id/player_end_credits_countdown"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="14dp"
                android:textColor="#FF69CD61"
                android:textSize="16sp"
                android:textStyle="bold"
                android:visibility="gone"
                tools:text="Starting in 28s"
                tools:visibility="visible" />

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="18dp"
                android:orientation="horizontal"
                tools:ignore="ButtonStyle">

                <Button
                    android:id="@+id/player_end_credits_play"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@drawable/next_up_primary_button"
                    android:focusable="true"
                    android:minWidth="0dp"
                    android:paddingStart="22dp"
                    android:paddingTop="9dp"
                    android:paddingEnd="22dp"
                    android:paddingBottom="9dp"
                    android:stateListAnimator="@null"
                    android:text="@string/next_up_play_now"
                    android:textAllCaps="false"
                    android:textColor="@color/next_up_button_text"
                    android:textSize="15sp" />

                <!-- Restores the picture and normal speed. Worded as watching the credits
                     rather than as dismissing a panel: somebody who presses this wants the
                     credits, and it is the only way back to them. -->
                <Button
                    android:id="@+id/player_end_credits_dismiss"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="10dp"
                    android:background="@drawable/next_up_secondary_button"
                    android:focusable="true"
                    android:minWidth="0dp"
                    android:paddingStart="22dp"
                    android:paddingTop="9dp"
                    android:paddingEnd="22dp"
                    android:paddingBottom="9dp"
                    android:stateListAnimator="@null"
                    android:text="@string/end_credits_watch"
                    android:textAllCaps="false"
                    android:textColor="@color/next_up_button_text"
                    android:textSize="15sp" />
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>
</FrameLayout>
