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

    <!--
    This parent FrameLayout is necessary because RecyclerView's ItemAnimator changes alpha values,
    which conflicts with our played state indicator.
    -->
    <LinearLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:gravity="center_vertical"
        android:baselineAligned="false"
        android:paddingStart="12dp"
        android:paddingLeft="12dp"
        android:paddingEnd="0dp"
        android:paddingRight="0dp"
        tools:ignore="UselessParent">

        <LinearLayout
            android:id="@+id/left_padding"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:minWidth="4dp">

            <ImageView
                android:id="@+id/drag_handle"
                android:layout_width="16dp"
                android:layout_height="match_parent"
                android:importantForAccessibility="no"
                android:scaleType="fitCenter"
                android:paddingStart="0dp"
                android:paddingLeft="0dp"
                android:paddingEnd="4dp"
                android:paddingRight="4dp"
                app:srcCompat="?attr/dragview_background"
                tools:src="@drawable/ic_drag_darktheme"
                tools:background="@android:color/holo_green_dark" />

        </LinearLayout>

        <androidx.cardview.widget.CardView
            android:id="@+id/coverHolder"
            android:layout_width="@dimen/thumbnail_length_queue_item"
            android:layout_height="@dimen/thumbnail_length_queue_item"
            android:layout_marginBottom="@dimen/listitem_threeline_verticalpadding"
            android:layout_marginTop="@dimen/listitem_threeline_verticalpadding"
            android:layout_marginRight="@dimen/listitem_threeline_textleftpadding"
            android:layout_marginEnd="@dimen/listitem_threeline_textleftpadding"
            app:cardBackgroundColor="@color/non_square_icon_background"
            app:cardCornerRadius="4dp"
            app:cardPreventCornerOverlap="false"
            app:cardElevation="0dp">

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

                <TextView
                    android:id="@+id/txtvPlaceholder"
                    android:layout_width="@dimen/thumbnail_length_queue_item"
                    android:layout_height="@dimen/thumbnail_length_queue_item"
                    android:layout_centerVertical="true"
                    android:gravity="center"
                    android:background="@color/light_gray"
                    android:maxLines="3"
                    android:padding="2dp"
                    android:ellipsize="end" />

                <ImageView
                    android:id="@+id/imgvCover"
                    android:layout_width="@dimen/thumbnail_length_queue_item"
                    android:layout_height="@dimen/thumbnail_length_queue_item"
                    android:layout_centerVertical="true"
                    android:importantForAccessibility="no"
                    tools:src="@tools:sample/avatars" />

            </RelativeLayout>

        </androidx.cardview.widget.CardView>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginBottom="@dimen/listitem_threeline_verticalpadding"
            android:layout_marginRight="@dimen/listitem_threeline_textrightpadding"
            android:layout_marginEnd="@dimen/listitem_threeline_textrightpadding"
            android:layout_marginTop="@dimen/listitem_threeline_verticalpadding"
            android:layout_weight="1"
            android:orientation="vertical"
            tools:background="@android:color/holo_red_dark">

            <LinearLayout
                android:id="@+id/status"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:gravity="center_vertical">

                <ImageView
                    android:id="@+id/statusInbox"
                    android:layout_width="14sp"
                    android:layout_height="14sp"
                    android:contentDescription="@string/is_inbox_label"
                    app:srcCompat="@drawable/ic_inbox" />

                <ImageView
                    android:id="@+id/ivIsVideo"
                    android:layout_width="14sp"
                    android:layout_height="14sp"
                    android:contentDescription="@string/media_type_video_label"
                    app:srcCompat="@drawable/ic_videocam" />

                <ImageView
                    android:id="@+id/isFavorite"
                    android:layout_width="14sp"
                    android:layout_height="14sp"
                    android:contentDescription="@string/is_favorite_label"
                    app:srcCompat="@drawable/ic_star" />

                <ImageView
                    android:id="@+id/ivInPlaylist"
                    android:layout_width="14sp"
                    android:layout_height="14sp"
                    android:contentDescription="@string/in_queue_label"
                    app:srcCompat="@drawable/ic_playlist_play" />

                <TextView
                    android:id="@+id/separatorIcons"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="4dp"
                    android:layout_marginStart="4dp"
                    android:layout_marginRight="4dp"
                    android:layout_marginEnd="4dp"
                    android:text="·"
                    android:importantForAccessibility="no"
                    style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
                    tools:background="@android:color/holo_blue_light" />

                <TextView
                    android:id="@+id/txtvPubDate"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginRight="4dp"
                    android:layout_marginEnd="4dp"
                    style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
                    tools:text="@sample/episodes.json/data/published_at" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginRight="4dp"
                    android:layout_marginEnd="4dp"
                    android:text="·"
                    android:importantForAccessibility="no"
                    style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
                    tools:background="@android:color/holo_blue_light" />

                <TextView
                    android:id="@+id/size"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginRight="4dp"
                    android:layout_marginEnd="4dp"
                    style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
                    tools:text="10 MB" />

            </LinearLayout>

            <!--
                Warning: android:contentDescription is set to an empty string.
                The title is read as contentDescription of left_padding to have it read first.
                Keep this in mind when changing the order of this layout!
            -->
            <TextView
                android:id="@+id/txtvTitle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:importantForAccessibility="no"
                android:ellipsize="end"
                style="@style/AntennaPod.TextView.ListItemPrimaryTitle"
                tools:text="@sample/episodes.json/data/title"
                tools:background="@android:color/holo_blue_light" />

            <LinearLayout
                android:id="@+id/progress"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:gravity="center_vertical">

                <TextView
                    android:id="@+id/txtvPosition"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="0dp"
                    style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
                    tools:text="00:42:23"
                    tools:background="@android:color/holo_blue_light" />

                <ProgressBar
                    android:id="@+id/progressBar"
                    android:layout_width="0dp"
                    android:layout_height="4dp"
                    android:layout_weight="1"
                    android:max="100"
                    android:layout_margin="4dp"
                    style="?android:attr/progressBarStyleHorizontal"
                    tools:background="@android:color/holo_blue_light" />

                <TextView
                    android:id="@+id/txtvDuration"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="0dp"
                    style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
                    tools:text="@sample/episodes.json/data/duration"
                    tools:background="@android:color/holo_blue_light" />

            </LinearLayout>

        </LinearLayout>

        <include
            android:id="@+id/secondaryActionButton"
            layout="@layout/secondary_action" />

    </LinearLayout>

</FrameLayout>
