<?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:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".media.manga.mangareader.MangaReaderActivity">

    <ani.dantotsu.media.manga.mangareader.Swipy
        android:id="@+id/mangaReaderSwipy"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <androidx.viewpager2.widget.ViewPager2
            android:id="@+id/mangaReaderPager"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            tools:ignore="SpeakableTextPresentCheck" />

        <com.alexvasilkov.gestures.views.GestureFrameLayout
            android:id="@+id/mangaReaderRecyclerContainer"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:gest_doubleTapZoom="3"
            app:gest_maxZoom="6"
            app:gest_restrictRotation="true"
            app:gest_rotationEnabled="true">

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/mangaReaderRecycler"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:clipToPadding="false"
                tools:ignore="SpeakableTextPresentCheck"
                tools:listitem="@layout/item_dual_page" />

        </com.alexvasilkov.gestures.views.GestureFrameLayout>
    </ani.dantotsu.media.manga.mangareader.Swipy>

    <FrameLayout
        android:id="@+id/BottomSwipeContainer"
        android:layout_width="match_parent"
        android:layout_height="192dp"
        android:layout_gravity="bottom"
        android:alpha="0">

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:srcCompat="@drawable/linear_gradient_black"
            tools:ignore="ContentDescription" />

        <com.google.android.material.card.MaterialCardView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            app:cardBackgroundColor="?attr/colorSurface"
            app:cardCornerRadius="16dp"
            app:contentPadding="8dp"
            app:strokeColor="?attr/colorSecondary"
            app:strokeWidth="2dp">

            <TextView
                android:id="@+id/BottomSwipeText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginStart="8dp"
                android:layout_marginEnd="8dp"
                android:fontFamily="@font/poppins_bold"
                android:text="@string/app_name"
                android:textColor="?attr/colorOnSurface"
                android:textSize="16sp" />
        </com.google.android.material.card.MaterialCardView>

    </FrameLayout>

    <FrameLayout
        android:id="@+id/TopSwipeContainer"
        android:layout_width="match_parent"
        android:layout_height="192dp"
        android:alpha="0">

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:rotation="180"
            app:srcCompat="@drawable/linear_gradient_black"
            tools:ignore="ContentDescription" />

        <com.google.android.material.card.MaterialCardView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|center_horizontal"
            app:cardBackgroundColor="?attr/colorSurface"
            app:cardCornerRadius="16dp"
            app:contentPadding="8dp"
            app:strokeColor="?attr/colorSecondary"
            app:strokeWidth="2dp">

            <TextView
                android:id="@+id/TopSwipeText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginStart="8dp"
                android:layout_marginEnd="8dp"
                android:fontFamily="@font/poppins_bold"
                android:text="@string/app_name"
                android:textColor="?attr/colorOnSurface"
                android:textSize="16sp" />
        </com.google.android.material.card.MaterialCardView>

    </FrameLayout>

    <FrameLayout
        android:id="@+id/RightSwipeContainer"
        android:layout_width="192dp"
        android:layout_height="match_parent"
        android:layout_gravity="right"
        android:alpha="0"
        tools:ignore="RtlHardcoded">

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:rotation="180"
            app:srcCompat="@drawable/linear_gradient_black_horizontal"
            tools:ignore="ContentDescription" />

        <com.google.android.material.card.MaterialCardView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            app:cardBackgroundColor="?attr/colorSurface"
            app:cardCornerRadius="16dp"
            app:contentPadding="8dp"
            app:strokeColor="?attr/colorSecondary"
            app:strokeWidth="2dp">

            <TextView
                android:id="@+id/RightSwipeText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginStart="8dp"
                android:layout_marginEnd="8dp"
                android:fontFamily="@font/poppins_bold"
                android:text="@string/app_name"
                android:textColor="?attr/colorOnSurface"
                android:textSize="16sp" />
        </com.google.android.material.card.MaterialCardView>

    </FrameLayout>

    <FrameLayout
        android:id="@+id/LeftSwipeContainer"
        android:layout_width="192dp"
        android:layout_height="match_parent"
        android:alpha="0">

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:srcCompat="@drawable/linear_gradient_black_horizontal"
            tools:ignore="ContentDescription" />

        <com.google.android.material.card.MaterialCardView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            app:cardBackgroundColor="?attr/colorSurface"
            app:cardCornerRadius="16dp"
            app:contentPadding="8dp"
            app:strokeColor="?attr/colorSecondary"
            app:strokeWidth="2dp">

            <TextView
                android:id="@+id/LeftSwipeText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginStart="8dp"
                android:layout_marginEnd="8dp"
                android:fontFamily="@font/poppins_bold"
                android:text="@string/app_name"
                android:textColor="?attr/colorOnSurface"
                android:textSize="16sp" />
        </com.google.android.material.card.MaterialCardView>

    </FrameLayout>

    <LinearLayout
        android:id="@+id/mangaReaderCont"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:visibility="gone"
        tools:visibility="visible">

        <FrameLayout
            android:id="@+id/mangaReaderTopCont"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleY="-1"
                app:srcCompat="@drawable/linear_gradient_black"
                tools:ignore="ContentDescription" />

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleY="-1"
                app:srcCompat="@drawable/linear_gradient_black"
                tools:ignore="ContentDescription" />

            <LinearLayout
                android:id="@+id/mangaReaderTopLayout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="32dp"
                android:clipToPadding="false"
                android:orientation="vertical"
                android:padding="8dp">

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

                    <ImageButton
                        android:id="@+id/mangaReaderBack"
                        android:layout_width="48dp"
                        android:layout_height="48dp"
                        android:backgroundTint="#00FFFFFF"
                        android:src="@drawable/ic_round_arrow_back_ios_new_24"
                        tools:ignore="ContentDescription,SpeakableTextPresentCheck,ImageContrastCheck" />

                    <LinearLayout
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:gravity="center_vertical"
                        android:orientation="vertical">

                        <ani.dantotsu.SpinnerNoSwipe
                            android:id="@+id/mangaReaderChapterSelect"
                            android:layout_width="match_parent"
                            android:layout_height="48dp"
                            android:layout_marginEnd="0dp"
                            android:layout_marginBottom="-10dp"
                            android:background="@drawable/spinner_icon_manga"
                            android:backgroundTint="#fff"
                            android:backgroundTintMode="src_atop"
                            android:entries="@array/tips"
                            android:popupBackground="@drawable/round_corner"
                            tools:ignore="SpeakableTextPresentCheck" />

                        <TextView
                            android:id="@+id/mangaReaderTitle"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginEnd="48dp"
                            android:fontFamily="@font/poppins"
                            android:singleLine="false"
                            android:textColor="@color/bg_white"
                            android:shadowColor="#000"
                            android:shadowDx="1"
                            android:shadowDy="1"
                            android:shadowRadius="1"
                            android:textSize="12sp"
                            tools:ignore="TextContrastCheck"
                            tools:text="@string/popular_anime" />

                    </LinearLayout>

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

                        <ImageButton
                            android:id="@+id/mangaReaderDownload"
                            android:layout_width="wrap_content"
                            android:layout_height="48dp"
                            android:backgroundTint="#00FFFFFF"
                            android:src="@drawable/ic_round_download_24"
                            android:visibility="gone"
                            app:layout_constraintBottom_toBottomOf="parent"
                            app:layout_constraintEnd_toEndOf="parent"
                            tools:ignore="ContentDescription,SpeakableTextPresentCheck,ImageContrastCheck" />

                        <ImageButton
                            android:id="@+id/mangaReaderSettings"
                            android:layout_width="48dp"
                            android:layout_height="48dp"
                            android:backgroundTint="#00FFFFFF"
                            android:scaleType="fitCenter"
                            android:src="@drawable/ic_round_settings_24"
                            app:tint="#fff"
                            tools:ignore="ContentDescription,SpeakableTextPresentCheck,ImageContrastCheck" />

                    </LinearLayout>

                </LinearLayout>

                <TextView
                    android:id="@+id/mangaReaderSource"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="-8dp"
                    android:layout_marginEnd="16dp"
                    android:fontFamily="@font/poppins_bold"
                    android:textAlignment="textEnd"
                    android:textColor="#fff"
                    android:textSize="12sp"
                    tools:ignore="TextContrastCheck"
                    tools:text="@string/server_selector" />

            </LinearLayout>
        </FrameLayout>

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_marginTop="-24dp"
            android:layout_marginBottom="-24dp"
            android:layout_weight="1">

            <FrameLayout
                android:id="@+id/mangaReaderSliderContainer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom|end"
                android:layout_margin="16dp"
                tools:ignore="UselessParent">

                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    app:srcCompat="@drawable/rounded_top_nav"
                    tools:ignore="ContentDescription,ImageContrastCheck" />

                <com.google.android.material.slider.Slider
                    android:id="@+id/mangaReaderSlider"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_gravity="center"
                    android:layout_marginStart="8dp"
                    android:layout_marginEnd="8dp"
                    android:contentDescription="@string/current_page"
                    android:stepSize="1"
                    android:valueFrom="1.0"
                    android:valueTo="100.0"
                    app:labelBehavior="floating"
                    app:labelStyle="@style/fontTooltip"
                    app:thumbRadius="8dp"
                    app:tickColor="#0000"
                    app:trackColorInactive="@color/grey_60"
                    app:trackColorActive="?attr/colorOnBackground"
                    app:trackHeight="2dp" />

            </FrameLayout>

        </FrameLayout>

        <FrameLayout
            android:id="@+id/mangaReaderBottomCont"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:layout_marginBottom="-48dp">

            <ImageView
                android:id="@+id/imageView3"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:srcCompat="@drawable/linear_gradient_black"
                tools:ignore="ContentDescription" />

            <ImageView
                android:id="@+id/imageView4"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:srcCompat="@drawable/linear_gradient_black"
                tools:ignore="ContentDescription" />

            <LinearLayout
                android:id="@+id/mangaReaderBottomLayout"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginTop="24dp"
                android:layout_marginBottom="8dp"
                android:orientation="horizontal"
                android:padding="8dp">

                <androidx.cardview.widget.CardView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:cardBackgroundColor="#00FFFFFF"
                    app:cardCornerRadius="16dp"
                    app:cardElevation="0dp">

                    <ImageButton
                        android:id="@+id/mangaReaderPreviousChapter"
                        style="@style/ExoMediaButton.Pause"
                        android:layout_width="48dp"
                        android:layout_height="48dp"
                        android:contentDescription="@string/previous"
                        android:scaleX="1.5"
                        android:scaleY="1.5"
                        android:src="@drawable/ic_round_skip_previous_24"
                        tools:ignore="DuplicateSpeakableTextCheck,ImageContrastCheck" />

                </androidx.cardview.widget.CardView>

                <LinearLayout
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_margin="8dp"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:orientation="vertical">

                    <TextView
                        android:id="@+id/mangaReaderPrevChap"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:elegantTextHeight="true"
                        android:ellipsize="end"
                        android:fontFamily="@font/poppins_bold"
                        android:maxLines="1"
                        android:textColor="#fff"
                        tools:ignore="NestedWeights" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_margin="8dp"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:orientation="vertical">

                    <TextView
                        android:id="@+id/mangaReaderNextChap"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:elegantTextHeight="true"
                        android:ellipsize="end"
                        android:fontFamily="@font/poppins_bold"
                        android:maxLines="1"
                        android:textAlignment="viewEnd"
                        android:textColor="#fff"
                        tools:ignore="NestedWeights"
                        tools:text="Chapter 200" />
                </LinearLayout>

                <androidx.cardview.widget.CardView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:cardBackgroundColor="#00FFFFFF"
                    app:cardCornerRadius="16dp"
                    app:cardElevation="0dp">

                    <ImageButton
                        android:id="@+id/mangaReaderNextChapter"
                        style="@style/ExoMediaButton.Pause"
                        android:layout_width="48dp"
                        android:layout_height="48dp"
                        android:layout_weight="1"
                        android:contentDescription="@string/next"
                        android:scaleX="1.5"
                        android:scaleY="1.5"
                        android:src="@drawable/ic_round_skip_next_24"
                        tools:ignore="ImageContrastCheck,DuplicateSpeakableTextCheck" />
                </androidx.cardview.widget.CardView>

            </LinearLayout>
        </FrameLayout>

    </LinearLayout>

    <ani.dantotsu.others.OutlineTextView
        android:id="@+id/mangaReaderPageNumber"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|center"
        android:fontFamily="@font/poppins_bold"
        android:padding="4dp"
        android:textAlignment="center"
        android:textColor="#FFFFFF"
        app:outlineColor="#A9000000"
        app:outlineWidth="1"
        tools:text="1/10" />
</FrameLayout>
