<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (c) Kacper Ziubryniewicz 2020-1-20
  -->

<layout 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">
    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

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

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginVertical="16dp"
                style="@style/TextAppearance.AppCompat.Small"
                android:text="@string/grades_config_title"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="4dp"
                android:gravity="center_vertical"
                android:orientation="horizontal">

                <CheckBox
                    android:id="@+id/customPlusCheckBox"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:minHeight="0dp"
                    android:text="@string/grades_config_plus_value" />

                <it.sephiroth.android.library.numberpicker.NumberPicker
                    android:id="@+id/customPlusValue"
                    android:layout_width="wrap_content"
                    android:layout_height="32dp"
                    app:picker_min="0.0"
                    app:picker_max="1.0"
                    app:picker_stepSize="0.01"
                    app:picker_disableGestures="true"
                    app:picker_orientation="horizontal" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="6dp"
                android:gravity="center_vertical"
                android:orientation="horizontal">

                <CheckBox
                    android:id="@+id/customMinusCheckBox"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:minHeight="0dp"
                    android:text="@string/grades_config_minus_value" />

                <it.sephiroth.android.library.numberpicker.NumberPicker
                    android:id="@+id/customMinusValue"
                    android:layout_width="wrap_content"
                    android:layout_height="32dp"
                    app:picker_min="0.0"
                    app:picker_max="1.0"
                    app:picker_stepSize="0.01"
                    app:picker_disableGestures="true"
                    app:picker_orientation="horizontal" />
            </LinearLayout>

            <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:layout_marginBottom="6dp"
                android:background="@drawable/divider"/>

            <CheckBox
                android:id="@+id/dontCountGrades"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:minHeight="0dp"
                android:text="@string/grades_config_dont_count_grades"/>

            <com.google.android.material.textfield.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
                android:hint="@string/grades_config_dont_count_hint"
                app:placeholderText="@string/grades_config_dont_count_placeholder"
                android:enabled="@{dontCountGrades.checked}">

                <pl.szczodrzynski.edziennik.utils.TextInputKeyboardEdit
                    android:id="@+id/dontCountGradesText"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    tools:text="nb, 0, +, -, bz"/>
            </com.google.android.material.textfield.TextInputLayout>

            <CheckBox
                android:id="@+id/hideImproved"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                android:minHeight="32dp"
                android:text="@string/grades_config_dont_show_improved"/>

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

                <CheckBox
                    android:id="@+id/averageWithoutWeight"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:minHeight="32dp"
                    android:text="@string/grades_config_average_without_weight"/>

                <com.mikepenz.iconics.view.IconicsImageView
                    android:id="@+id/averageWithoutWeightHelp"
                    android:layout_width="32dp"
                    android:layout_height="32dp"
                    android:background="?selectableItemBackgroundBorderless"
                    android:scaleType="centerInside"
                    app:iiv_color="?android:textColorSecondary"
                    app:iiv_icon="cmd-help-circle-outline"
                    app:iiv_size="24dp"
                    tools:src="@android:drawable/ic_menu_help" />
            </LinearLayout>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginVertical="4dp"
                style="@style/TextAppearance.AppCompat.Small"
                android:text="@string/menu_grades_sort_mode"/>

            <RadioGroup
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <RadioButton
                    android:id="@+id/sortGradesByDateRadio"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:minHeight="0dp"
                    android:text="@string/dialog_grades_config_sort_by_date" />

                <RadioButton
                    android:id="@+id/sortGradesBySubjectRadio"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:minHeight="0dp"
                    android:text="@string/dialog_grades_config_sort_by_subject"/>
            </RadioGroup>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                android:layout_marginBottom="4dp"
                style="@style/TextAppearance.AppCompat.Small"
                android:text="@string/menu_grades_color_mode"/>

            <RadioGroup
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <RadioButton
                    android:id="@+id/gradeColorFromERegister"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:minHeight="0dp"
                    android:text="@string/dialog_grades_config_color_from_eregister"/>

                <RadioButton
                    android:id="@+id/gradeColorByValue"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:minHeight="0dp"
                    android:text="@string/dialog_grades_config_color_by_value"/>
            </RadioGroup>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                android:layout_marginBottom="4dp"
                style="@style/TextAppearance.AppCompat.Small"
                android:text="@string/menu_grades_average_mode"/>

            <RadioGroup
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <RadioButton
                    android:id="@+id/gradeAverageMode4"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:minHeight="0dp"
                    android:text="@string/settings_register_avg_mode_4"/>

                <RadioButton
                    android:id="@+id/gradeAverageMode0"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:minHeight="0dp"
                    android:text="@string/settings_register_avg_mode_0"/>

                <RadioButton
                    android:id="@+id/gradeAverageMode1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:minHeight="0dp"
                    android:text="@string/settings_register_avg_mode_1"/>

                <RadioButton
                    android:id="@+id/gradeAverageMode2"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:minHeight="0dp"
                    android:text="@string/settings_register_avg_mode_2"/>

                <RadioButton
                    android:id="@+id/gradeAverageMode3"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:minHeight="0dp"
                    android:text="@string/settings_register_avg_mode_3"/>
            </RadioGroup>
        </LinearLayout>
    </ScrollView>
</layout>
