<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="wrap_content"
    android:layout_marginStart="-24dp"
    android:layout_marginEnd="-24dp"
    android:clipToPadding="false"
    android:orientation="vertical">

    <LinearLayout
        android:id="@+id/animeSourceContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="-16dp"
        android:layout_marginBottom="-24dp"
        android:clipToPadding="false"
        android:orientation="vertical"
        android:padding="32dp">

        <Button
            android:id="@+id/animeSourceYT"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="16dp"
            android:backgroundTint="?attr/colorSecondaryContainer"
            android:insetTop="0dp"
            android:insetBottom="0dp"
            android:text="@string/play_yt"
            android:textColor="?attr/colorOnSecondaryContainer"
            android:visibility="gone"
            app:cornerRadius="12dp"
            app:icon="@drawable/ic_round_play_circle_24"
            app:iconTint="?attr/colorOnSecondaryContainer"
            tools:ignore="TextContrastCheck" />

        <TextView
            android:id="@+id/animeSourceTitle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="end"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp"
            android:ellipsize="marquee"
            android:fontFamily="@font/poppins_bold"
            android:marqueeRepeatLimit="marquee_forever"
            android:singleLine="true"
            tools:text="@string/get_recommendations" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center_vertical"
            android:orientation="horizontal">

            <com.google.android.material.textfield.TextInputLayout
                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
                android:layout_width="0dp"

                android:layout_height="56dp"
                android:layout_weight="1"
                android:hint="@string/source"
                app:boxCornerRadiusBottomEnd="8dp"
                app:boxCornerRadiusBottomStart="8dp"
                app:boxCornerRadiusTopEnd="8dp"
                app:boxCornerRadiusTopStart="8dp"
                app:hintAnimationEnabled="true"
                app:boxStrokeColor="@color/text_input_layout_stroke_color"
                app:startIconDrawable="@drawable/ic_round_source_24">

                <AutoCompleteTextView
                    android:id="@+id/animeSource"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:fontFamily="@font/poppins_bold"
                    android:freezesText="false"
                    android:inputType="none"
                    android:padding="8dp"
                    android:text="@string/watch"
                    android:textAllCaps="true"
                    android:textColor="?android:attr/textColorSecondary"
                    android:textSize="14sp"
                    android:ellipsize="end"
                    android:maxLines="1"
                    tools:ignore="LabelFor,TextContrastCheck,DuplicateSpeakableTextCheck" />
            </com.google.android.material.textfield.TextInputLayout>


            <ImageView
                android:id="@+id/animeSourceSubscribe"
                android:layout_width="48dp"
                android:layout_height="wrap_content"
                android:padding="8dp"
                android:layout_gravity="center_vertical"
                app:srcCompat="@drawable/ic_round_notifications_none_24"
                app:tint="?attr/colorOnBackground"
                tools:ignore="ContentDescription,ImageContrastCheck" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <com.google.android.material.textfield.TextInputLayout
                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
                android:layout_width="0dp"

                android:layout_height="56dp"
                android:layout_weight="1"
                android:hint="Language"
                app:boxCornerRadiusBottomEnd="8dp"
                app:boxCornerRadiusBottomStart="8dp"
                app:boxCornerRadiusTopEnd="8dp"
                app:boxCornerRadiusTopStart="8dp"
                app:hintAnimationEnabled="true"
                app:boxStrokeColor="@color/text_input_layout_stroke_color"
                app:startIconDrawable="@drawable/ic_round_source_24">

                <AutoCompleteTextView
                    android:id="@+id/animeSourceLanguage"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:fontFamily="@font/poppins_bold"
                    android:freezesText="false"
                    android:inputType="none"
                    android:padding="8dp"
                    android:text="LANG"
                    android:textAllCaps="true"
                    android:textColor="?android:attr/textColorSecondary"
                    android:textSize="14sp"
                    tools:ignore="LabelFor,TextContrastCheck,DuplicateSpeakableTextCheck" />
            </com.google.android.material.textfield.TextInputLayout>

            <ImageView
                android:id="@+id/animeSourceSettings"
                android:layout_width="48dp"
                android:layout_height="wrap_content"
                android:padding="8dp"
                android:layout_gravity="center_vertical"
                app:srcCompat="@drawable/ic_round_settings_24"
                app:tint="?attr/colorOnBackground"
                tools:ignore="ContentDescription,ImageContrastCheck" />
        </LinearLayout>


        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginStart="-12dp"
            android:layout_marginEnd="-12dp"
            android:orientation="horizontal">

            <LinearLayout
                android:id="@+id/animeSourceDubbedCont"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:orientation="horizontal"
                android:visibility="gone">

                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/animeSourceDubbed"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:checked="false"
                    android:padding="12dp"
                    app:cornerRadius="0dp"
                    app:showText="false"
                    app:thumbTint="@color/button_switch_track" />

                <TextView
                    android:id="@+id/animeSourceDubbedText"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginStart="-8dp"
                    android:elegantTextHeight="true"
                    android:ellipsize="marquee"
                    android:fontFamily="@font/poppins_bold"
                    android:marqueeRepeatLimit="marquee_forever"
                    android:singleLine="true"
                    tools:text="Dubbed" />

            </LinearLayout>

            <TextView
                android:id="@+id/animeSourceSearch"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="end"
                android:clickable="true"
                android:focusable="true"
                android:fontFamily="@font/poppins_bold"
                android:padding="12dp"
                android:text="@string/wrong"
                android:textAlignment="textEnd"
                android:textColor="?attr/colorSecondary"
                tools:ignore="TextContrastCheck" />
        </FrameLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center_vertical"
            android:orientation="horizontal">

            <TextView
                android:id="@+id/sourceTitle"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:fontFamily="@font/poppins_bold"
                android:text="@string/eps"
                android:textSize="16sp" />

            <ImageView
                android:id="@+id/animeSourceList"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:alpha="0.33"
                android:padding="8dp"
                app:srcCompat="@drawable/ic_round_view_list_24"
                app:tint="?attr/colorOnBackground"
                tools:ignore="ContentDescription,ImageContrastCheck" />

            <ImageView
                android:id="@+id/animeSourceGrid"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:alpha="0.33"
                android:padding="8dp"
                app:srcCompat="@drawable/ic_round_grid_view_24"
                app:tint="?attr/colorOnBackground"
                tools:ignore="ContentDescription,ImageContrastCheck" />

            <ImageView
                android:id="@+id/animeSourceCompact"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:alpha="0.33"
                android:padding="8dp"
                app:srcCompat="@drawable/ic_round_view_comfy_24"
                app:tint="?attr/colorOnBackground"
                tools:ignore="ContentDescription,ImageContrastCheck" />

            <ImageView
                android:id="@+id/animeSourceTop"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:alpha="1"
                android:padding="8dp"
                android:rotation="90"
                app:srcCompat="@drawable/ic_round_arrow_back_ios_new_24"
                app:tint="?attr/colorOnBackground"
                tools:ignore="ContentDescription,ImageContrastCheck" />
        </LinearLayout>

        <androidx.cardview.widget.CardView
            android:id="@+id/animeSourceContinue"
            android:layout_width="match_parent"
            android:layout_height="80dp"
            android:layout_gravity="center"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp"
            android:visibility="gone"
            app:cardCornerRadius="16dp"
            app:cornerRadius="12dp"
            tools:visibility="visible">

            <ImageView
                android:id="@+id/itemEpisodeImage"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="centerCrop"
                tools:ignore="ContentDescription,ImageContrastCheck"
                tools:srcCompat="@tools:sample/backgrounds/scenic" />

            <View
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:alpha="0.6"
                android:background="@color/bg_black" />

            <View
                android:id="@+id/itemEpisodeFillerView"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:background="@color/filler"
                android:visibility="gone" />

            <TextView
                android:id="@+id/animeSourceContinueText"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="16dp"
                android:ellipsize="end"
                android:fontFamily="@font/poppins_bold"
                android:gravity="center"
                android:maxLines="2"
                android:text="@string/continue_watching"
                android:textColor="@color/bg_white"
                app:drawableEndCompat="@drawable/ic_round_play_arrow_24" />

            <LinearLayout
                android:id="@+id/itemEpisodeProgressCont"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom"
                android:orientation="horizontal">

                <View
                    android:id="@+id/itemEpisodeProgress"
                    android:layout_width="0dp"
                    android:layout_height="2dp"
                    android:layout_weight="0"
                    android:background="?attr/colorPrimary" />

                <View
                    android:id="@+id/itemEpisodeProgressEmpty"
                    android:layout_width="0dp"
                    android:layout_height="2dp"
                    android:layout_weight="1" />

            </LinearLayout>
        </androidx.cardview.widget.CardView>

    </LinearLayout>

    <HorizontalScrollView
        android:id="@+id/animeWatchChipScroll"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:clipToPadding="false"
        android:paddingStart="28dp"
        android:paddingEnd="28dp"
        android:scrollbars="none">

        <com.google.android.material.chip.ChipGroup
            android:id="@+id/animeSourceChipGroup"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:singleLine="true"
            app:singleSelection="true" />
    </HorizontalScrollView>

    <ProgressBar
        android:id="@+id/animeSourceProgressBar"
        style="?android:attr/progressBarStyle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        tools:visibility="gone" />

    <TextView
        android:id="@+id/animeSourceNotFound"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fontFamily="@font/poppins_bold"
        android:padding="32dp"
        android:text="@string/source_not_found"
        android:textAlignment="center"
        android:textSize="16sp"
        android:visibility="gone" />

</LinearLayout>