<?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="52dp"
    android:layout_gravity="center_vertical"
    android:id="@+id/constraint_layout"
    android:background="@drawable/list_item_selector">

    <include
        layout="@layout/in_library_badge"
        android:id="@+id/in_library_badge"
        android:layout_width="16dp"
        android:layout_height="16dp"
        app:layout_constraintStart_toStartOf="parent"
        android:layout_marginTop="2dp"
        android:layout_marginStart="2dp"
        app:layout_constraintTop_toTopOf="parent" />

    <com.google.android.material.card.MaterialCardView
        android:id="@+id/card"
        android:layout_width="wrap_content"
        android:layout_height="@dimen/material_layout_avatar"
        android:layout_marginTop="6dp"
        android:layout_marginBottom="6dp"
        android:layout_marginStart="8dp"
        app:layout_constrainedHeight="true"
        app:cardElevation="0dp"
        app:cardBackgroundColor="@color/background"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.0">

        <ImageView
            android:id="@+id/cover_thumbnail"
            android:layout_width="@dimen/material_layout_avatar"
            android:layout_height="@dimen/material_layout_avatar"
            android:adjustViewBounds="true"
            android:background="?android:attr/colorBackground"
            app:layout_constrainedHeight="true"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            android:scaleType="centerCrop"
            tools:background="?android:attr/colorBackground"
            tools:ignore="ContentDescription"
            tools:src="@mipmap/ic_launcher" />

        <ProgressBar
            android:id="@+id/progress"
            style="?android:attr/progressBarStyleSmall"
            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>

    <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="6dp"
        android:layout_marginEnd="6dp"
        android:ellipsize="end"
        android:maxLines="2"
        android:textColor="?android:attr/textColorPrimary"
        android:textSize="16sp"
        app:layout_constrainedWidth="true"
        app:layout_constraintEnd_toStartOf="@id/unread_download_badge"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toEndOf="@+id/card"
        app:layout_constraintTop_toTopOf="parent"
        tools:text="Manga title" />

    <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="6dp"
        android:ellipsize="end"
        android:maxLines="1"
        android:singleLine="true"
        android:textColor="?android:attr/textColorSecondary"
        android:textSize="14sp"
        app:layout_constrainedWidth="true"
        app:layout_constraintEnd_toStartOf="@id/unread_download_badge"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="@+id/title"
        app:layout_constraintTop_toBottomOf="@+id/title"
        app:layout_constraintVertical_bias="0.0"
        tools:text="Manga artist" />

    <include layout="@layout/unread_download_badge"
        android:id="@+id/unread_download_badge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="2dp"
        android:layout_marginTop="0dp"
        android:layout_marginEnd="12dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toTopOf="parent"/>

    <androidx.constraintlayout.widget.Barrier
        android:id="@+id/bottom_list_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="card,subtitle" />

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