<?xml version="1.0" encoding="utf-8"?>
<eu.kanade.tachiyomi.widget.StatefulNestedScrollView 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/stats_scroll_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clipToPadding="false"
    android:background="?background"
    android:fitsSystemWindows="true"
    tools:context="eu.kanade.tachiyomi.ui.more.stats.StatsController">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/marginNormal"
        android:layout_marginEnd="@dimen/marginNormal"
        android:orientation="vertical"
        android:paddingTop="@dimen/marginSmall"
        android:paddingBottom="@dimen/marginSmall">

        <com.google.android.material.button.MaterialButton
            android:id="@+id/view_detail_layout"
            style="@style/Widget.Tachiyomi.Button.OutlinedButton.Icon"
            android:backgroundTint="?background"
            android:layout_gravity="end"
            android:text="@string/view_detailed_statistics"
            app:icon="@drawable/ic_brief" />

        <com.google.android.material.textview.MaterialTextView
            style="?textAppearanceLabelLarge"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="@dimen/marginNormal"
            android:text="@string/general"
            android:textColor="?android:attr/textColorSecondary" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="20dp"
            android:baselineAligned="false">

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical"
                android:paddingStart="@dimen/marginClose"
                android:paddingEnd="@dimen/marginClose">

                <com.google.android.material.textview.MaterialTextView
                    android:id="@+id/stats_total_manga_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:textColor="?attr/colorSecondary"
                    tools:text="0" />

                <com.google.android.material.textview.MaterialTextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom|center_horizontal"
                    android:layout_marginTop="@dimen/marginClose"
                    android:gravity="center"
                    android:text="@string/titles_in_library" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical"
                android:paddingStart="@dimen/marginClose"
                android:paddingEnd="@dimen/marginClose">

                <com.google.android.material.textview.MaterialTextView
                    android:id="@+id/stats_total_chapters_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:textColor="?attr/colorSecondary"
                    tools:text="0" />

                <com.google.android.material.textview.MaterialTextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom|center_horizontal"
                    android:layout_marginTop="@dimen/marginClose"
                    android:gravity="center"
                    android:text="@string/total_chapters" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical"
                android:paddingStart="@dimen/marginClose"
                android:paddingEnd="@dimen/marginClose">

                <com.google.android.material.textview.MaterialTextView
                    android:id="@+id/stats_chapters_read_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:textColor="?attr/colorSecondary"
                    tools:text="0" />

                <com.google.android.material.textview.MaterialTextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom|center_horizontal"
                    android:layout_marginTop="@dimen/marginClose"
                    android:gravity="center"
                    android:text="@string/chapters_read" />

            </LinearLayout>

            <LinearLayout
                android:id="@+id/stats_manga_mean_score_layout"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical"
                android:paddingStart="@dimen/marginClose"
                android:paddingEnd="@dimen/marginClose">

                <com.google.android.material.textview.MaterialTextView
                    android:id="@+id/stats_manga_mean_score_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:drawablePadding="3dp"
                    android:gravity="center"
                    android:textColor="?attr/colorSecondary"
                    app:drawableEndCompat="@drawable/ic_star_12dp"
                    app:drawableTint="?attr/colorSecondary"
                    tools:text="0" />

                <com.google.android.material.textview.MaterialTextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom|center_horizontal"
                    android:layout_marginTop="@dimen/marginClose"
                    android:gravity="center"
                    android:text="@string/mean_tracking_score" />

            </LinearLayout>

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="20dp"
            android:baselineAligned="false">

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical"
                android:paddingStart="@dimen/marginClose"
                android:paddingEnd="@dimen/marginClose">

                <com.google.android.material.textview.MaterialTextView
                    android:id="@+id/stats_tracked_manga_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:textColor="?attr/colorSecondary"
                    tools:text="0" />

                <com.google.android.material.textview.MaterialTextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom|center_horizontal"
                    android:layout_marginTop="@dimen/marginClose"
                    android:gravity="center"
                    android:text="@string/tracked_titles" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical"
                android:paddingStart="@dimen/marginClose"
                android:paddingEnd="@dimen/marginClose">

                <com.google.android.material.textview.MaterialTextView
                    android:id="@+id/stats_global_update_manga_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:textColor="?attr/colorSecondary"
                    tools:text="0" />

                <com.google.android.material.textview.MaterialTextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom|center_horizontal"
                    android:layout_marginTop="@dimen/marginClose"
                    android:gravity="center"
                    android:text="@string/titles_in_global_update" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical"
                android:paddingStart="@dimen/marginClose"
                android:paddingEnd="@dimen/marginClose">

                <com.google.android.material.textview.MaterialTextView
                    android:id="@+id/stats_chapters_downloaded_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:textColor="?attr/colorSecondary"
                    tools:text="0" />

                <com.google.android.material.textview.MaterialTextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom|center_horizontal"
                    android:layout_marginTop="@dimen/marginClose"
                    android:gravity="center"
                    android:text="@string/downloaded_chapters" />

            </LinearLayout>

            <LinearLayout
                android:id="@+id/stats_read_duration_layout"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical"
                android:paddingStart="@dimen/marginClose"
                android:paddingEnd="@dimen/marginClose">

                <com.google.android.material.textview.MaterialTextView
                    android:id="@+id/stats_read_duration_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:textColor="?attr/colorSecondary"
                    tools:text="0" />

                <com.google.android.material.textview.MaterialTextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom|center_horizontal"
                    android:layout_marginTop="@dimen/marginClose"
                    android:gravity="center"
                    android:text="@string/read_duration" />

            </LinearLayout>
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="@dimen/marginPage"
            android:baselineAligned="false">

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical"
                android:paddingStart="@dimen/marginClose"
                android:paddingEnd="@dimen/marginClose">

                <com.google.android.material.textview.MaterialTextView
                    android:id="@+id/stats_manga_local_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:textColor="?attr/colorSecondary"
                    tools:text="0" />

                <com.google.android.material.textview.MaterialTextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom|center_horizontal"
                    android:layout_marginTop="@dimen/marginClose"
                    android:gravity="center"
                    android:text="@string/local_titles" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical"
                android:paddingStart="@dimen/marginClose"
                android:paddingEnd="@dimen/marginClose">

                <com.google.android.material.textview.MaterialTextView
                    android:id="@+id/stats_total_tags_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:textColor="?attr/colorSecondary"
                    tools:text="0" />

                <com.google.android.material.textview.MaterialTextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom|center_horizontal"
                    android:layout_marginTop="@dimen/marginClose"
                    android:gravity="center"
                    android:text="@string/tags" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical"
                android:paddingStart="@dimen/marginClose"
                android:paddingEnd="@dimen/marginClose">

                <com.google.android.material.textview.MaterialTextView
                    android:id="@+id/stats_sources_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:textColor="?attr/colorSecondary"
                    tools:text="0" />

                <com.google.android.material.textview.MaterialTextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom|center_horizontal"
                    android:layout_marginTop="@dimen/marginClose"
                    android:gravity="center"
                    android:text="@string/sources" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical"
                android:paddingStart="@dimen/marginClose"
                android:paddingEnd="@dimen/marginClose">

                <com.google.android.material.textview.MaterialTextView
                    android:id="@+id/stats_trackers_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:textColor="?attr/colorSecondary"
                    tools:text="0" />

                <com.google.android.material.textview.MaterialTextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom|center_horizontal"
                    android:layout_marginTop="@dimen/marginClose"
                    android:gravity="center"
                    android:text="@string/trackers" />

            </LinearLayout>

        </LinearLayout>

        <LinearLayout
            android:id="@+id/manga_stats_status_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="@dimen/marginPage"
            android:orientation="vertical"
            android:visibility="gone"
            tools:visibility="visible">

            <com.google.android.material.textview.MaterialTextView
                style="?textAppearanceLabelLarge"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/marginNormal"
                android:text="@string/manga_status_distribution"
                android:textColor="?android:attr/textColorSecondary" />

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/manga_stats_status_chart_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal">

                <com.github.mikephil.charting.charts.PieChart
                    android:id="@+id/manga_stats_status_pie_chart"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintDimensionRatio="@fraction/chartRatio"
                    app:layout_constraintEnd_toStartOf="@id/manga_stats_status_recycler_view"
                    app:layout_constraintHeight_max="600dp"
                    app:layout_constraintHorizontal_bias="0.0"
                    app:layout_constraintHorizontal_chainStyle="packed"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/manga_stats_status_recycler_view"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="12dp"
                    android:nestedScrollingEnabled="false"
                    app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toEndOf="@id/manga_stats_status_pie_chart"
                    app:layout_constraintTop_toTopOf="parent"
                    tools:listitem="@layout/list_chart_legend" />

            </androidx.constraintlayout.widget.ConstraintLayout>
        </LinearLayout>

        <LinearLayout
            android:id="@+id/manga_stats_score_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="@dimen/marginPage"
            android:orientation="vertical"
            android:visibility="gone">

            <com.google.android.material.textview.MaterialTextView
                style="?textAppearanceLabelLarge"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/marginNormal"
                android:text="@string/manga_score_distribution"
                android:textColor="?android:attr/textColorSecondary" />

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/manga_stats_score_chart_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:maxWidth="600dp">

                <com.github.mikephil.charting.charts.BarChart
                    android:id="@+id/manga_stats_score_bar_chart"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    app:layout_constraintDimensionRatio="@fraction/chartRatio"
                    app:layout_constraintTop_toTopOf="parent" />

            </androidx.constraintlayout.widget.ConstraintLayout>
        </LinearLayout>
    </LinearLayout>

</eu.kanade.tachiyomi.widget.StatefulNestedScrollView>