<?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:id="@+id/mangaContainer"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginStart="-16dp"
    android:layout_marginEnd="-16dp"
    android:orientation="vertical">

    <FrameLayout
        android:id="@+id/mangaTrendingContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="16dp">

        <androidx.viewpager2.widget.ViewPager2
            android:id="@+id/mangaTrendingViewPager"
            android:layout_width="match_parent"
            android:layout_height="464dp" />

        <LinearLayout
            android:id="@+id/mangaTitleContainer"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="32dp"
            android:orientation="horizontal">

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/mangaSearchBar"
                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
                android:layout_width="0dp"
                android:layout_height="56dp"
                android:layout_marginEnd="8dp"
                android:layout_weight="1"
                android:hint="@string/manga"
                android:textColorHint="?attr/colorPrimary"
                android:transitionName="@string/search"
                app:boxBackgroundColor="?attr/colorPrimaryContainer"
                app:boxCornerRadiusBottomEnd="28dp"
                app:boxCornerRadiusBottomStart="28dp"
                app:boxCornerRadiusTopEnd="28dp"
                app:boxCornerRadiusTopStart="28dp"
                app:endIconDrawable="@drawable/ic_round_search_24"
                app:endIconTint="?attr/colorPrimary"
                app:boxStrokeColor="@color/text_input_layout_stroke_color"
                app:hintAnimationEnabled="true">

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

            <com.google.android.material.card.MaterialCardView
                android:id="@+id/mangaUserAvatarContainer"
                android:layout_width="52dp"
                android:layout_height="match_parent"
                android:layout_marginTop="4dp"
                app:cardBackgroundColor="?attr/colorPrimaryContainer"
                app:strokeColor="@color/text_input_layout_stroke_color"
                app:cardCornerRadius="26dp">

                <com.google.android.material.imageview.ShapeableImageView
                    android:id="@+id/mangaUserAvatar"
                    android:layout_width="52dp"
                    android:layout_height="52dp"
                    android:scaleType="center"
                    android:tint="?attr/colorPrimary"
                    app:srcCompat="@drawable/ic_round_settings_24"
                    tools:ignore="ContentDescription,ImageContrastCheck" />

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

        </LinearLayout>

        <ProgressBar
            android:id="@+id/mangaTrendingProgressBar"
            style="?android:attr/progressBarStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginTop="64dp" />

    </FrameLayout>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/mangaListContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clipToPadding="false"
        android:paddingStart="24dp"
        android:paddingEnd="24dp">

        <com.google.android.material.card.MaterialCardView
            android:id="@+id/mangaGenre"
            android:layout_width="match_parent"
            android:layout_height="72dp"
            android:layout_margin="8dp"
            app:cardCornerRadius="16dp"
            app:layout_constrainedWidth="true"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/mangaTopScore"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintWidth_max="256dp">

            <ImageView
                android:id="@+id/mangaGenreImage"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="centerCrop"
                tools:ignore="ContentDescription"
                tools:src="@tools:sample/backgrounds/scenic" />

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

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

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:fontFamily="@font/poppins_bold"
                    android:text="@string/genres"
                    android:textAllCaps="true"
                    android:textColor="@color/bg_white"
                    android:textSize="16sp" />

                <View
                    android:layout_width="64dp"
                    android:layout_height="2dp"
                    android:layout_gravity="center"
                    android:background="?attr/colorPrimary" />
            </LinearLayout>
        </com.google.android.material.card.MaterialCardView>

        <com.google.android.material.card.MaterialCardView
            android:id="@+id/mangaTopScore"
            android:layout_width="match_parent"
            android:layout_height="72dp"
            android:layout_margin="8dp"
            android:layout_marginBottom="16dp"
            app:cardCornerRadius="16dp"
            app:layout_constrainedWidth="true"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toEndOf="@+id/mangaGenre"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintWidth_max="256dp">

            <ImageView
                android:id="@+id/mangaTopScoreImage"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="centerCrop"
                tools:ignore="ContentDescription"
                tools:src="@tools:sample/backgrounds/scenic" />

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

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

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:fontFamily="@font/poppins_bold"
                    android:text="@string/top_score"
                    android:textAllCaps="true"
                    android:textColor="@color/bg_white"
                    android:textSize="16sp" />

                <View
                    android:layout_width="64dp"
                    android:layout_height="2dp"
                    android:layout_gravity="center"
                    android:background="?attr/colorPrimary" />
            </LinearLayout>

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

    </androidx.constraintlayout.widget.ConstraintLayout>

    <TextView
        android:id="@+id/mangaNovel"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="24dp"
        android:fontFamily="@font/poppins_bold"
        android:padding="8dp"
        android:text="@string/trending_novel"
        android:textSize="16sp" />

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="250dp">

        <ProgressBar
            android:id="@+id/mangaNovelProgressBar"
            style="?android:attr/progressBarStyle"
            android:layout_width="wrap_content"
            android:layout_height="48dp"
            android:layout_gravity="center" />

        <ani.dantotsu.FadingEdgeRecyclerView
            android:id="@+id/mangaNovelRecyclerView"
            android:layout_width="match_parent"
            android:layout_height="250dp"
            android:clipToPadding="false"
            android:nestedScrollingEnabled="true"
            android:paddingStart="20dp"
            android:paddingEnd="20dp"
            android:requiresFadingEdge="horizontal"
            tools:itemCount="4"
            tools:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
            tools:listitem="@layout/item_media_compact"
            tools:orientation="horizontal" />

    </FrameLayout>

    <LinearLayout
        android:id="@+id/mangaPopular"
        android:visibility="invisible"
        tools:visibility="visible"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="24dp"
        android:layout_marginEnd="24dp"
        android:orientation="horizontal">

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:fontFamily="@font/poppins_bold"
            android:padding="8dp"
            android:text="@string/popular_manga"
            android:textSize="16sp" />

        <androidx.appcompat.widget.SwitchCompat
            android:id="@+id/mangaIncludeList"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/include_media_in_list"
            android:checked="true"/>


    </LinearLayout>

</LinearLayout>
