<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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="100dp"
    android:layout_marginHorizontal="24dp"
    android:layout_marginBottom="24dp"
    android:clickable="true"
    android:focusable="true"
    android:foreground="@drawable/ripple_background">

    <com.google.android.material.imageview.ShapeableImageView
        android:id="@+id/episode_image"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:scaleType="centerCrop"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Findroid.Image" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="8dp"
        android:orientation="horizontal"
        app:layout_constraintEnd_toEndOf="@id/episode_image"
        app:layout_constraintTop_toTopOf="@id/episode_image">

        <ImageView
            android:id="@+id/downloaded_icon"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:layout_marginStart="8dp"
            android:background="@drawable/circle_background"
            android:contentDescription="@string/downloaded_indicator"
            android:padding="4dp"
            android:src="@drawable/ic_download"
            android:visibility="gone"
            app:layout_constraintEnd_toEndOf="@id/episode_image"
            app:layout_constraintTop_toTopOf="@id/episode_image"
            app:tint="?attr/colorOnPrimary"
            tools:visibility="visible" />

        <FrameLayout
            android:id="@+id/missing_icon"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:layout_marginStart="8dp"
            android:background="@drawable/circle_background"
            android:backgroundTint="?attr/colorError"
            app:layout_constraintEnd_toStartOf="@id/played_icon"
            app:layout_constraintTop_toTopOf="@id/episode_image"
            tools:visibility="visible">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center"
                android:text="M"
                android:textColor="@android:color/white"
                tools:ignore="HardcodedText" />

        </FrameLayout>

        <ImageView
            android:id="@+id/played_icon"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:layout_marginStart="8dp"
            android:background="@drawable/circle_background"
            android:contentDescription="@string/episode_watched_indicator"
            android:padding="4dp"
            android:src="@drawable/ic_check"
            app:layout_constraintEnd_toEndOf="@id/episode_image"
            app:layout_constraintTop_toTopOf="@id/episode_image"
            app:tint="?attr/colorOnPrimary" />

    </LinearLayout>

    <FrameLayout
        android:id="@+id/progress_bar"
        android:layout_width="wrap_content"
        android:layout_height="4dp"
        android:layout_marginHorizontal="8dp"
        android:layout_marginBottom="8dp"
        android:background="@drawable/button_setup_background"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="@id/episode_image"
        app:layout_constraintStart_toStartOf="@id/episode_image"
        tools:layout_width="50dp"
        tools:visibility="visible" />

    <TextView
        android:id="@+id/episode_title"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="12dp"
        android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
        app:layout_constraintBottom_toTopOf="@id/episode_overview"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@id/episode_image"
        app:layout_constraintTop_toTopOf="parent"
        tools:text="1. To You, in 2000 Years: The Fall of Shiganshina, Part 1" />

    <TextView
        android:id="@+id/episode_overview"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:scrollbars="none"
        android:textAppearance="@style/TextAppearance.Material3.BodySmall"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="@id/episode_title"
        app:layout_constraintTop_toBottomOf="@id/episode_title"
        tools:text="After one hundred years of peace, humanity is suddenly reminded of the terror of being at the Titans' mercy. After one hundred years of peace, humanity is suddenly reminded of the terror of being at the Titans' mercy." />

    <FrameLayout
        android:layout_width="0dp"
        android:layout_height="24dp"
        android:background="@drawable/header_gradient"
        app:layout_constraintBottom_toBottomOf="@id/episode_overview"
        app:layout_constraintEnd_toEndOf="@id/episode_overview"
        app:layout_constraintStart_toStartOf="@id/episode_overview" />
</androidx.constraintlayout.widget.ConstraintLayout>