<?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:squareImageView="http://schemas.android.com/apk/de.danoeh.antennapod"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="4dp"
    android:clipToPadding="false"
    tools:layout_width="150dp">

    <androidx.cardview.widget.CardView
        android:id="@+id/outerContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clickable="false"
        android:foreground="?attr/selectableItemBackground"
        app:cardCornerRadius="12dp"
        app:cardElevation="1dp">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <androidx.cardview.widget.CardView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:clickable="false"
                app:cardBackgroundColor="@color/non_square_icon_background"
                app:cardCornerRadius="12dp"
                app:cardElevation="0dp">

                <RelativeLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="1px">

                    <de.danoeh.antennapod.ui.common.SquareImageView
                        android:id="@+id/coverImage"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:scaleType="fitCenter"
                        android:outlineProvider="background"
                        squareImageView:direction="width"
                        tools:src="@tools:sample/avatars" />

                    <TextView
                        android:id="@+id/fallbackTitleLabel"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignStart="@+id/coverImage"
                        android:layout_alignLeft="@+id/coverImage"
                        android:layout_alignTop="@+id/coverImage"
                        android:layout_alignEnd="@+id/coverImage"
                        android:layout_alignRight="@+id/coverImage"
                        android:layout_alignBottom="@+id/coverImage"
                        android:background="@color/feed_text_bg"
                        android:gravity="center"
                        android:ellipsize="end"
                        android:padding="6dp"
                        android:textColor="#fff"
                        tools:text="@sample/episodes.json/data/title" />

                    <ImageView
                        android:id="@+id/gradientOverlay"
                        android:layout_width="match_parent"
                        android:layout_height="48dp"
                        android:layout_gravity="top"
                        android:rotation="180"
                        android:alpha="0.6"
                        android:visibility="gone"
                        tools:visibility="visible"
                        app:srcCompat="@drawable/bg_gradient"
                        app:tint="#000" />

                    <TextView
                        android:id="@+id/countViewPill"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="3"
                        android:layout_alignParentEnd="true"
                        android:textSize="14sp"
                        style="@style/TextPill" />

                    <ImageView
                        android:id="@+id/errorIcon"
                        android:layout_width="24dp"
                        android:layout_height="24dp"
                        android:layout_alignParentEnd="true"
                        android:layout_alignBottom="@id/coverImage"
                        android:layout_margin="8dp"
                        android:visibility="gone"
                        android:contentDescription="@string/refresh_failed_msg"
                        app:srcCompat="@drawable/ic_error"
                        tools:visibility="visible" />

                </RelativeLayout>

            </androidx.cardview.widget.CardView>

            <TextView
                android:id="@+id/titleLabel"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:gravity="start"
                android:textColor="?android:attr/textColorPrimary"
                android:lines="2"
                android:importantForAccessibility="no"
                tools:text="@sample/episodes.json/data/title" />

        </LinearLayout>

    </androidx.cardview.widget.CardView>

    <ImageView
        android:id="@+id/selectedIcon"
        android:layout_width="32dp"
        android:layout_height="32dp"
        android:layout_gravity="top"
        android:visibility="gone"
        android:layout_margin="4dp"
        android:elevation="2dp"
        tools:visibility="visible"
        app:srcCompat="@drawable/circle_unchecked" />

</FrameLayout>
