<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="match_parent"
    android:orientation="vertical"
    tools:context=".ui.modules.grade.statistics.GradeStatisticsFragment">

    <io.github.wulkanowy.ui.widgets.MaterialLinearLayout
        android:id="@+id/gradeStatisticsSubjectsContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?android:windowBackground"
        android:padding="5dp"
        android:visibility="invisible"
        tools:ignore="UnusedAttribute"
        tools:listitem="@layout/item_attendance_summary"
        tools:visibility="visible">

        <Spinner
            android:id="@+id/gradeStatisticsSubjects"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ellipsize="middle"
            android:paddingStart="10dp"
            android:paddingLeft="10dp"
            android:paddingTop="10dp"
            android:paddingEnd="30dp"
            android:paddingRight="30dp"
            android:paddingBottom="10dp"
            android:spinnerMode="dialog" />
    </io.github.wulkanowy.ui.widgets.MaterialLinearLayout>

    <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
        android:id="@+id/gradeStatisticsSwipe"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <androidx.core.widget.NestedScrollView
            android:id="@+id/gradeStatisticsScroll"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fillViewport="true">

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

                <HorizontalScrollView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center">

                    <RadioGroup
                        android:id="@+id/gradeStatisticsTypeSwitch"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal"
                        android:paddingStart="16dp"
                        android:paddingTop="5dp"
                        android:paddingEnd="16dp"
                        android:visibility="invisible"
                        tools:visibility="visible">

                        <com.google.android.material.radiobutton.MaterialRadioButton
                            android:id="@+id/gradeStatisticsTypePartial"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:checked="true"
                            android:tag="partial"
                            android:text="@string/grade_statistics_partial" />

                        <com.google.android.material.radiobutton.MaterialRadioButton
                            android:id="@+id/gradeStatisticsTypeSemester"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:tag="annual"
                            android:text="@string/grade_statistics_semester" />

                        <com.google.android.material.radiobutton.MaterialRadioButton
                            android:id="@+id/gradeStatisticsTypePoints"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:tag="points"
                            android:text="@string/grade_statistics_points" />
                    </RadioGroup>
                </HorizontalScrollView>

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

                    <androidx.recyclerview.widget.RecyclerView
                        android:id="@+id/gradeStatisticsRecycler"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        tools:listitem="@layout/item_grade_statistics_pie" />

                    <me.zhanghai.android.materialprogressbar.MaterialProgressBar
                        android:id="@+id/gradeStatisticsProgress"
                        style="@style/Widget.MaterialProgressBar.ProgressBar"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:indeterminate="true"
                        tools:visibility="gone" />

                    <LinearLayout
                        android:id="@+id/gradeStatisticsEmpty"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:gravity="center"
                        android:orientation="vertical"
                        android:visibility="invisible"
                        tools:ignore="UseCompoundDrawables">

                        <ImageView
                            android:layout_width="100dp"
                            android:layout_height="100dp"
                            app:srcCompat="@drawable/ic_main_grade"
                            app:tint="?colorOnBackground"
                            tools:ignore="contentDescription" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="20dp"
                            android:gravity="center"
                            android:text="@string/grade_no_items"
                            android:textSize="20sp" />
                    </LinearLayout>


                    <LinearLayout
                        android:id="@+id/gradeStatisticsError"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:gravity="center"
                        android:orientation="vertical"
                        android:visibility="invisible"
                        tools:ignore="UseCompoundDrawables"
                        tools:visibility="invisible">

                        <ImageView
                            android:layout_width="100dp"
                            android:layout_height="100dp"
                            app:srcCompat="@drawable/ic_error"
                            app:tint="?colorOnBackground"
                            tools:ignore="contentDescription" />

                        <TextView
                            android:id="@+id/gradeStatisticsErrorMessage"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="20dp"
                            android:gravity="center"
                            android:padding="8dp"
                            android:text="@string/error_unknown"
                            android:textSize="20sp" />

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="16dp"
                            android:gravity="center"
                            android:orientation="horizontal">

                            <com.google.android.material.button.MaterialButton
                                android:id="@+id/gradeStatisticsErrorDetails"
                                style="@style/Widget.MaterialComponents.Button.OutlinedButton"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginEnd="8dp"
                                android:layout_marginRight="8dp"
                                android:text="@string/all_details" />

                            <com.google.android.material.button.MaterialButton
                                android:id="@+id/gradeStatisticsErrorRetry"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/all_retry" />
                        </LinearLayout>
                    </LinearLayout>
                </FrameLayout>
            </LinearLayout>
        </androidx.core.widget.NestedScrollView>
    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
