<?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/recent_manga_layout"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="?android:attr/colorBackground">

    <FrameLayout
        android:id="@+id/right_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/material_green_800"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <ImageView
            android:id="@+id/read"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:layout_gravity="end|center"
            android:layout_marginEnd="21dp"
            android:src="@drawable/ic_eye_24dp"
            app:tint="@color/md_white_1000" />
    </FrameLayout>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/front_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:background="@drawable/list_item_selector"
        android:minHeight="@dimen/material_component_lists_single_line_with_avatar_height">

        <FrameLayout
            android:id="@+id/card_layout"
            android:layout_width="60dp"
            android:layout_height="80dp"
            android:layout_marginStart="12dp"
            android:layout_marginTop="6dp"
            android:layout_marginBottom="6dp"
            app:layout_constrainedHeight="true"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintVertical_bias="0.0">

            <com.google.android.material.card.MaterialCardView
                android:id="@+id/card"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_gravity="center">

                <ImageView
                    android:id="@+id/cover_thumbnail"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:adjustViewBounds="true"
                    android:background="?android:attr/colorBackground"
                    android:foreground="?android:attr/selectableItemBackground"
                    android:maxHeight="60dp"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    tools:ignore="ContentDescription"
                    tools:src="@mipmap/ic_launcher" />

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

        <com.google.android.material.textview.MaterialTextView
            android:id="@+id/title"
            style="@style/TextAppearance.Regular.Body1.SemiBold"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="12dp"
            android:layout_marginTop="2dp"
            android:layout_marginEnd="16dp"
            android:ellipsize="end"
            android:maxLines="1"
            android:textColor="?android:attr/textColorPrimary"
            android:textSize="16sp"
            app:layout_constrainedWidth="true"
            app:layout_constraintBottom_toTopOf="@id/subtitle"
            app:layout_constraintVertical_chainStyle="packed"

            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.0"
            app:flow_verticalBias="0.0"
            app:layout_constraintStart_toEndOf="@id/card_layout"
            app:layout_constraintTop_toTopOf="parent"
            tools:text="New Chapter" />

        <com.google.android.material.textview.MaterialTextView
            android:id="@+id/subtitle"
            style="@style/TextAppearance.MaterialComponents.Body1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="16dp"
            android:ellipsize="end"
            android:maxLines="1"
            android:singleLine="true"
            android:textColor="?android:attr/textColorPrimary"
            android:textSize="14sp"
            app:layout_constrainedWidth="true"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintStart_toStartOf="@+id/title"
            app:layout_constraintTop_toBottomOf="@+id/title"
            app:layout_constraintBottom_toTopOf="@id/body"
            tools:text="Manga title" />

        <com.google.android.material.textview.MaterialTextView
            android:id="@+id/body"
            style="@style/TextAppearance.MaterialComponents.Body1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="6dp"
            android:ellipsize="end"
            android:lineSpacingExtra="2dp"
            android:maxLines="2"
            android:textColor="?android:attr/textColorSecondary"
            android:textSize="14sp"
            app:layout_constrainedWidth="true"
            app:layout_constraintBottom_toTopOf="@id/space"
            app:layout_constraintEnd_toStartOf="@id/button_layout"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintStart_toStartOf="@+id/title"
            app:layout_constraintTop_toBottomOf="@id/subtitle"
            app:layout_constraintVertical_bias="0.0"
            tools:text="3 Days ago" />

        <Space
            android:id="@+id/space"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintBottom_toTopOf="@id/bottom_line"
            app:layout_constraintTop_toBottomOf="@id/body" />

        <ProgressBar
            android:id="@+id/progress"
            style="?android:attr/progressBarStyleHorizontal"
            android:layout_width="0dp"
            android:layout_height="3dp"
            android:layout_gravity="bottom"
            android:layout_marginTop="4dp"
            android:layout_marginEnd="6dp"
            android:background="#66000000"
            android:indeterminate="false"
            android:progress="10"
            android:progressTint="?colorAccent"
            android:visibility="gone"
            app:layout_constraintEnd_toStartOf="@id/button_layout"
            app:layout_constraintStart_toStartOf="@id/title"
            app:layout_constraintTop_toBottomOf="@id/subtitle" />


        <LinearLayout
            android:id="@+id/button_layout"
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_marginEnd="8dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toBottomOf="@id/subtitle">

            <ImageButton
                android:id="@+id/remove_history"
                android:layout_width="45dp"
                android:layout_height="match_parent"
                android:background="?selectableItemBackgroundBorderless"
                android:contentDescription="@string/next_title"
                android:padding="8dp"
                android:tooltipText="@string/reset_chapter_history"
                app:layout_constraintHorizontal_chainStyle="spread"
                app:srcCompat="@drawable/ic_eye_remove_outline_24dp"
                app:tint="@color/holo_red" />

            <include
                android:id="@+id/download_button"
                layout="@layout/download_button"
                android:layout_width="45dp"
                android:layout_height="match_parent" />
        </LinearLayout>

        <androidx.constraintlayout.widget.Barrier
            android:id="@+id/bottom_line"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="6dp"
            android:orientation="horizontal"
            app:barrierDirection="bottom"
            app:constraint_referenced_ids="space,card_layout" />

        <View
            android:id="@+id/padding"
            android:layout_width="0dp"
            android:layout_height="6dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintTop_toBottomOf="@id/bottom_line" />
    </androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>