<?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:id="@+id/manga_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/constraint_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:background="@drawable/library_grid_selector"
        android:foreground="@drawable/library_grid_selector_overlay"
        android:orientation="vertical">

        <com.google.android.material.card.MaterialCardView
            android:id="@+id/card"
            android:layout_width="match_parent"
            app:strokeColor="@color/library_stroke_selector"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:layout_marginStart="6dp"
            android:layout_marginTop="6dp"
            android:layout_marginEnd="6dp"
            app:layout_constraintBottom_toTopOf="@+id/text_layout"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintVertical_bias="1.0">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/cover_constraint"
                android:layout_width="match_parent"
                android:background="?attr/background"
                android:layout_height="wrap_content">

                <com.google.android.material.textview.MaterialTextView
                    android:id="@+id/behind_title"
                    style="?textAppearanceBodyMedium"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:ellipsize="end"
                    android:textColor="?colorOnBackground"
                    android:layout_marginStart="4dp"
                    android:layout_marginEnd="4dp"
                    android:textAlignment="center"
                    android:gravity="center"
                    android:maxLines="3"
                    app:layout_constraintTop_toTopOf="@id/cover_thumbnail"
                    app:layout_constraintBottom_toBottomOf="@id/cover_thumbnail"
                    app:layout_constraintEnd_toEndOf="@id/cover_thumbnail"
                    app:layout_constraintStart_toStartOf="@id/cover_thumbnail"
                    tools:text="Sample name" />

                <ImageView
                    android:id="@+id/cover_thumbnail"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    tools:alpha="0.5"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    tools:adjustViewBounds="true"
                    android:scaleType="centerCrop"
                    tools:ignore="ContentDescription"
                    app:layout_constraintVertical_bias="0.0"
                    tools:src="@mipmap/ic_launcher" />

                <View
                    android:id="@+id/gradient"
                    android:layout_width="0dp"
                    android:layout_height="125sp"
                    android:alpha="0.75"
                    android:background="@drawable/gradient_shape"
                    app:layout_constraintStart_toStartOf="@id/cover_thumbnail"
                    app:layout_constraintEnd_toEndOf="@id/cover_thumbnail"
                    app:layout_constraintBottom_toBottomOf="@id/cover_thumbnail"
                    app:layout_constraintVertical_bias="0.0" />

            </androidx.constraintlayout.widget.ConstraintLayout>

            <FrameLayout
                android:id="@+id/play_layout"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:layout_gravity="end"
                android:clickable="true"
                android:focusable="true"
                android:visibility="gone"
                tools:visibility="visible">

                <ImageView
                    android:id="@+id/play_button"
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:layout_gravity="end"
                    android:layout_marginTop="6dp"
                    android:layout_marginEnd="6dp"
                    android:layout_marginBottom="6dp"
                    android:background="@drawable/round_play_background"
                    android:contentDescription="@string/start_reading"
                    android:padding="6dp"
                    android:src="@drawable/ic_start_reading_24dp"
                    app:tint="@android:color/white" />

            </FrameLayout>

            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/compact_title"
                style="?textAppearanceLabelMedium"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom"
                android:layout_marginStart="4dp"
                android:layout_marginEnd="4dp"
                android:layout_marginBottom="4dp"
                android:ellipsize="end"
                android:maxLines="2"
                android:textColor="@android:color/white"
                android:textSize="13sp"
                tools:text="Sample name" />

            <com.google.android.material.progressindicator.CircularProgressIndicator
                android:id="@+id/progress"
                app:indicatorSize="16dp"
                app:trackThickness="3dp"
                android:indeterminate="true"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:visibility="gone"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

        </com.google.android.material.card.MaterialCardView>

        <include
            layout="@layout/unread_download_badge"
            android:id="@+id/unread_download_badge"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            android:layout_marginTop="3dp"
            android:layout_marginStart="3dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>

        <View
            android:id="@+id/badge_guide"
            android:layout_width="match_parent"
            android:layout_height="10dp"
            app:layout_constraintTop_toTopOf="@+id/card" />

        <LinearLayout
            android:id="@+id/text_layout"
            android:layout_width="match_parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            android:layout_marginStart="6dp"
            android:layout_marginEnd="6dp"
            android:layout_marginBottom="4dp"
            android:orientation="vertical"
            android:layout_height="31sp">
            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/title"
                style="?textAppearanceBodySmall"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                app:lineHeight="15sp"
                android:maxLines="2"
                android:textColor="@color/library_comfortable_title_selector"
                app:layout_constraintBottom_toTopOf="@+id/subtitle"
                tools:text="Sample name" />

            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/subtitle"
                style="?textAppearanceBodySmall"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="@color/library_comfortable_subtitle_selector"
                android:layout_marginTop="-1dp"
                android:ellipsize="end"
                android:singleLine="true"
                tools:text="Sample artist" />
        </LinearLayout>

    </androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
