<?xml version="1.0" encoding="utf-8"?>

<layout xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <data>
        <variable name="config" type="io.github.chinosk.gakumas.localify.models.GakumasConfig" />
        <variable
            name="listener"
            type="io.github.chinosk.gakumas.localify.ConfigListener" />
    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="6sp"
        tools:context=".MainActivity">

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent">

                <TextView
                    android:id="@+id/textViewTitle"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/gakumas_localify"
                    android:textColor="@color/black"
                    android:textSize="20sp" />

                <Space
                    android:layout_width="match_parent"
                    android:layout_height="25sp" />

                <TableLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical"
                    android:stretchColumns="0">

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

                        <com.google.android.material.switchmaterial.SwitchMaterial
                            android:id="@+id/SwitchEnablePlugin"
                            android:layout_width="match_parent"
                            android:layout_height="48dp"
                            android:checked="@={config.enabled}"
                            android:onCheckedChanged="@{(view, value) -> listener.onEnabledChanged(value)}"
                            android:text="@string/enable_plugin" />
                    </TableRow>

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

                        <com.google.android.material.textfield.TextInputLayout
                            android:layout_width="match_parent"
                            android:layout_height="48dp"
                            android:background="@android:color/transparent"
                            android:hint="@string/setFpsTitle"
                            app:boxBackgroundColor="@android:color/transparent">

                            <com.google.android.material.textfield.TextInputEditText
                                android:id="@+id/editTextTargetFps"
                                android:layout_width="match_parent"
                                android:layout_height="48dp"
                                android:ems="10"
                                android:inputType="numberSigned"
                                android:onTextChanged="@{(s, st, b, a) -> listener.onTargetFpsChanged(s, st, b, a)}"
                                android:paddingStart="0dp"
                                android:paddingEnd="0dp"
                                android:paddingBottom="0dp"
                                android:text="@={`` + config.targetFrameRate}" />

                        </com.google.android.material.textfield.TextInputLayout>

                    </TableRow>

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

                        <com.google.android.material.switchmaterial.SwitchMaterial
                            android:id="@+id/SwitchEnableFreeCameraPlugin"
                            android:layout_width="match_parent"
                            android:layout_height="48dp"
                            android:checked="@={config.enableFreeCamera}"
                            android:onCheckedChanged="@{(view, value) -> listener.onEnableFreeCameraChanged(value)}"
                            android:text="@string/enable_free_camera" />
                    </TableRow>

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

                        <com.google.android.material.switchmaterial.SwitchMaterial
                            android:id="@+id/SwitchUnlockAllLive"
                            android:layout_width="match_parent"
                            android:layout_height="48dp"
                            android:checked="@={config.unlockAllLive}"
                            android:onCheckedChanged="@{(view, value) -> listener.onUnlockAllLiveChanged(value)}"
                            android:text="@string/unlockAllLive" />
                    </TableRow>

                    <TableRow
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:background="@drawable/table_row_border">

                        <TableLayout
                            android:layout_width="wrap_content"
                            android:layout_height="match_parent"
                            android:orientation="vertical"
                            android:paddingLeft="10sp"
                            android:paddingRight="10sp"
                            android:paddingBottom="10sp"
                            android:stretchColumns="0">

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

                                <com.google.android.material.switchmaterial.SwitchMaterial
                                    android:id="@+id/SwitchLiveUseCustomeDress"
                                    android:layout_width="match_parent"
                                    android:layout_height="48dp"
                                    android:checked="@={config.enableLiveCustomeDress}"
                                    android:onCheckedChanged="@{(view, value) -> listener.onLiveCustomeDressChanged(value)}"
                                    android:text="@string/liveUseCustomeDress" />
                            </TableRow>

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

                                <com.google.android.material.textfield.TextInputLayout
                                    android:layout_width="match_parent"
                                    android:layout_height="48dp"
                                    android:background="@android:color/transparent"
                                    android:hint="@string/live_costume_head_id"
                                    app:boxBackgroundColor="@android:color/transparent">

                                    <com.google.android.material.textfield.TextInputEditText
                                        android:id="@+id/editTextLiveCustomeCharaId"
                                        android:layout_width="match_parent"
                                        android:layout_height="match_parent"
                                        android:ems="10"
                                        android:onTextChanged="@{(s, st, b, a) -> listener.onLiveCustomeHeadIdChanged(s, st, b, a)}"
                                        android:paddingStart="0dp"
                                        android:paddingEnd="0dp"
                                        android:paddingBottom="0dp"
                                        android:text="@={config.liveCustomeHeadId}" />

                                </com.google.android.material.textfield.TextInputLayout>
                            </TableRow>

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

                                <com.google.android.material.textfield.TextInputLayout
                                    android:layout_width="match_parent"
                                    android:layout_height="48dp"
                                    android:background="@android:color/transparent"
                                    android:hint="@string/live_custome_dress_id"
                                    app:boxBackgroundColor="@android:color/transparent">

                                    <com.google.android.material.textfield.TextInputEditText
                                        android:id="@+id/editTextLiveCustomeCostumeId"
                                        android:layout_width="match_parent"
                                        android:layout_height="match_parent"
                                        android:ems="10"
                                        android:onTextChanged="@{(s, st, b, a) -> listener.onLiveCustomeCostumeIdChanged(s, st, b, a)}"
                                        android:paddingStart="0dp"
                                        android:paddingEnd="0dp"
                                        android:paddingBottom="0dp"
                                        android:text="@={config.liveCustomeCostumeId}" />
                                </com.google.android.material.textfield.TextInputLayout>
                            </TableRow>
                        </TableLayout>

                    </TableRow>

                    <TableRow
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_marginTop="4sp"
                        android:background="@drawable/table_row_border">

                        <TableLayout
                            android:layout_width="wrap_content"
                            android:layout_height="match_parent"
                            android:orientation="vertical"
                            android:paddingLeft="10sp"
                            android:paddingRight="10sp"
                            android:paddingBottom="10sp"
                            android:stretchColumns="0">

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

                                <com.google.android.material.switchmaterial.SwitchMaterial
                                    android:id="@+id/SwitchUseCustomeGraphicSettings"
                                    android:layout_width="match_parent"
                                    android:layout_height="48dp"
                                    android:checked="@={config.useCustomeGraphicSettings}"
                                    android:onCheckedChanged="@{(view, value) -> listener.onUseCustomeGraphicSettingsChanged(value)}"
                                    android:text="@string/useCustomeGraphicSettings" />
                            </TableRow>


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

                                <LinearLayout
                                    android:layout_width="match_parent"
                                    android:layout_height="match_parent"
                                    android:orientation="horizontal"
                                    app:layout_constraintBottom_toBottomOf="parent"
                                    app:layout_constraintEnd_toEndOf="parent"
                                    app:layout_constraintStart_toStartOf="parent"
                                    app:layout_constraintTop_toTopOf="parent">

                                    <com.google.android.material.button.MaterialButton
                                        android:id="@+id/qualityRecordButton"
                                        android:layout_width="wrap_content"
                                        android:layout_height="48dp"
                                        android:layout_margin="1sp"
                                        android:layout_weight="1"
                                        android:minWidth="1sp"
                                        android:onClick="@{() -> listener.onChangePresetQuality(4)}"
                                        android:text="极高" />

                                    <com.google.android.material.button.MaterialButton
                                        android:id="@+id/qualityVeryHighButton"
                                        android:layout_width="wrap_content"
                                        android:layout_height="48dp"
                                        android:layout_margin="1sp"
                                        android:layout_weight="1"
                                        android:minWidth="1sp"
                                        android:onClick="@{() -> listener.onChangePresetQuality(3)}"
                                        android:text="超高" />

                                    <com.google.android.material.button.MaterialButton
                                        android:id="@+id/qualityHighButton"
                                        android:layout_width="wrap_content"
                                        android:layout_height="48dp"
                                        android:layout_margin="1sp"
                                        android:layout_weight="1"
                                        android:minWidth="1sp"
                                        android:onClick="@{() -> listener.onChangePresetQuality(2)}"
                                        android:text="高" />

                                    <com.google.android.material.button.MaterialButton
                                        android:id="@+id/qualityMidButton"
                                        android:layout_width="wrap_content"
                                        android:layout_height="48dp"
                                        android:layout_margin="1sp"
                                        android:layout_weight="1"
                                        android:minWidth="1sp"
                                        android:onClick="@{() -> listener.onChangePresetQuality(1)}"
                                        android:text="中" />

                                    <com.google.android.material.button.MaterialButton
                                        android:id="@+id/qualityLowButton"
                                        android:layout_width="wrap_content"
                                        android:layout_height="48dp"
                                        android:layout_weight="1"
                                        android:minWidth="1sp"
                                        android:onClick="@{() -> listener.onChangePresetQuality(0)}"
                                        android:text="低" />

                                </LinearLayout>

                            </TableRow>

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

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

                                    <TableRow
                                        android:layout_width="match_parent"
                                        android:layout_height="match_parent"
                                        android:weightSum="2">

                                        <com.google.android.material.textfield.TextInputLayout
                                            android:id="@+id/editTextRenderScaleLayout"
                                            android:layout_width="match_parent"
                                            android:layout_height="48dp"
                                            android:layout_weight="1"
                                            android:background="@android:color/transparent"
                                            android:hint="@string/renderscale"
                                            app:boxBackgroundColor="@android:color/transparent">

                                            <com.google.android.material.textfield.TextInputEditText
                                                android:id="@+id/editTextRenderScale"
                                                android:layout_width="match_parent"
                                                android:layout_height="match_parent"
                                                android:ems="10"
                                                android:hint="0.5/0.59/0.67/0.77/1.0"
                                                android:inputType="numberDecimal"
                                                android:onTextChanged="@{(s, st, b, a) -> listener.onRenderScaleChanged(s, st, b, a)}"
                                                android:paddingStart="0dp"
                                                android:paddingEnd="0dp"
                                                android:paddingBottom="0dp"
                                                android:text="@={`` + config.renderScale}" />

                                        </com.google.android.material.textfield.TextInputLayout>

                                        <com.google.android.material.textfield.TextInputLayout
                                            android:id="@+id/editTextQualitySettingsLevelLayout"
                                            android:layout_width="match_parent"
                                            android:layout_height="48dp"
                                            android:layout_weight="1"
                                            android:background="@android:color/transparent"
                                            android:hint="QualityLevel (1/1/2/3/5)"
                                            app:boxBackgroundColor="@android:color/transparent">

                                            <com.google.android.material.textfield.TextInputEditText
                                                android:id="@+id/editTextQualitySettingsLevel"
                                                android:layout_width="match_parent"
                                                android:layout_height="match_parent"
                                                android:ems="10"
                                                android:hint="1/1/2/3/5"
                                                android:inputType="number"
                                                android:onTextChanged="@{(s, st, b, a) -> listener.onQualitySettingsLevelChanged(s, st, b, a)}"
                                                android:paddingStart="0dp"
                                                android:paddingEnd="0dp"
                                                android:paddingBottom="0dp"
                                                android:text="@={`` + config.qualitySettingsLevel}" />

                                        </com.google.android.material.textfield.TextInputLayout>


                                    </TableRow>

                                    <TableRow
                                        android:layout_width="match_parent"
                                        android:layout_height="match_parent"
                                        android:weightSum="2">

                                        <com.google.android.material.textfield.TextInputLayout
                                            android:id="@+id/editTextVolumeIndexLayout"
                                            android:layout_width="match_parent"
                                            android:layout_height="48dp"
                                            android:layout_weight="1"
                                            android:background="@android:color/transparent"
                                            android:hint="VolumeIndex (0/1/2/3/4)"
                                            app:boxBackgroundColor="@android:color/transparent">

                                            <com.google.android.material.textfield.TextInputEditText
                                                android:id="@+id/editTextVolumeIndex"
                                                android:layout_width="match_parent"
                                                android:layout_height="match_parent"
                                                android:ems="10"
                                                android:hint="0/1/2/3/4"
                                                android:inputType="number"
                                                android:onTextChanged="@{(s, st, b, a) -> listener.onVolumeIndexChanged(s, st, b, a)}"
                                                android:paddingStart="0dp"
                                                android:paddingEnd="0dp"
                                                android:paddingBottom="0dp"
                                                android:text="@={`` + config.volumeIndex}" />

                                        </com.google.android.material.textfield.TextInputLayout>

                                        <com.google.android.material.textfield.TextInputLayout
                                            android:id="@+id/editTextMaxBufferPixelLayout"
                                            android:layout_width="match_parent"
                                            android:layout_height="48dp"
                                            android:layout_weight="1"
                                            android:background="@android:color/transparent"
                                            android:hint="MaxBufferPixel (1024/1440/2538/3384/8190)"
                                            app:boxBackgroundColor="@android:color/transparent">

                                            <com.google.android.material.textfield.TextInputEditText
                                                android:id="@+id/editTextMaxBufferPixel"
                                                android:layout_width="match_parent"
                                                android:layout_height="match_parent"
                                                android:ems="10"
                                                android:hint="1024/1440/2538/3384/8190"
                                                android:inputType="number"
                                                android:onTextChanged="@{(s, st, b, a) -> listener.onMaxBufferPixelChanged(s, st, b, a)}"
                                                android:paddingStart="0dp"
                                                android:paddingEnd="0dp"
                                                android:paddingBottom="0dp"
                                                android:text="@={`` + config.maxBufferPixel}" />

                                        </com.google.android.material.textfield.TextInputLayout>


                                    </TableRow>

                                    <TableRow
                                        android:layout_width="match_parent"
                                        android:layout_height="match_parent"
                                        android:weightSum="2">

                                        <com.google.android.material.textfield.TextInputLayout
                                            android:layout_width="match_parent"
                                            android:layout_height="48dp"
                                            android:layout_weight="1"
                                            android:background="@android:color/transparent"
                                            android:hint="ReflectionLevel (0~5)"
                                            app:boxBackgroundColor="@android:color/transparent">

                                            <com.google.android.material.textfield.TextInputEditText
                                                android:id="@+id/editTextReflectionQualityLevel"
                                                android:layout_width="match_parent"
                                                android:layout_height="match_parent"
                                                android:ems="10"
                                                android:hint="0/1/2/3/4/5"
                                                android:inputType="number"
                                                android:onTextChanged="@{(s, st, b, a) -> listener.onReflectionQualityLevelChanged(s, st, b, a)}"
                                                android:paddingStart="0dp"
                                                android:paddingEnd="0dp"
                                                android:paddingBottom="0dp"
                                                android:text="@={`` + config.reflectionQualityLevel}" />

                                        </com.google.android.material.textfield.TextInputLayout>

                                        <com.google.android.material.textfield.TextInputLayout
                                            android:layout_width="match_parent"
                                            android:layout_height="48dp"
                                            android:layout_weight="1"
                                            android:background="@android:color/transparent"
                                            android:hint="LOD Level (0~5)"
                                            app:boxBackgroundColor="@android:color/transparent">

                                            <com.google.android.material.textfield.TextInputEditText
                                                android:id="@+id/editTextLodQualityLevel"
                                                android:layout_width="match_parent"
                                                android:layout_height="match_parent"
                                                android:ems="10"
                                                android:hint="0/1/2/3/4/5"
                                                android:inputType="number"
                                                android:onTextChanged="@{(s, st, b, a) -> listener.onLodQualityLevelChanged(s, st, b, a)}"
                                                android:paddingStart="0dp"
                                                android:paddingEnd="0dp"
                                                android:paddingBottom="0dp"
                                                android:text="@={`` + config.lodQualityLevel}" />

                                        </com.google.android.material.textfield.TextInputLayout>


                                    </TableRow>

                                </TableLayout>
                            </TableRow>
                        </TableLayout>

                    </TableRow>

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

                        <com.google.android.material.button.MaterialButton
                            android:id="@+id/StartGameButton"
                            android:layout_width="match_parent"
                            android:layout_height="48dp"
                            android:onClick="@{() -> listener.onClickStartGame()}"
                            android:text="@string/start_game" />
                    </TableRow>

                </TableLayout>
            </LinearLayout>

        </ScrollView>
    </androidx.constraintlayout.widget.ConstraintLayout>
</layout>
