<?xml version="1.0" encoding="utf-8"?>
<!--
  TimeLimit Copyright <C> 2019 - 2023 Jonas Lochmann
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation version 3 of the License.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<layout xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <data>
        <variable
            name="title"
            type="String" />

        <variable
            name="isAddLimitMode"
            type="boolean" />

        <import type="android.view.View" />
    </data>

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

        <TextView
            android:padding="8dp"
            android:textAppearance="?android:textAppearanceLarge"
            tools:text="Erlaubte Spiele"
            android:text="@{title}"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <io.timelimit.android.ui.view.SafeViewFlipper
            android:id="@+id/flipper"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:measureAllChildren="false">

            <LinearLayout
                android:id="@+id/type_selection"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <CheckedTextView
                    android:text="@string/manage_child_special_mode_wizard_block_option"
                    android:background="?selectableItemBackground"
                    android:id="@+id/block_temporarily_option"
                    android:layout_width="match_parent"
                    android:layout_height="?android:attr/listPreferredItemHeightSmall"
                    android:textAppearance="?android:attr/textAppearanceListItemSmall"
                    android:gravity="center_vertical"
                    android:checkMark="?android:attr/listChoiceIndicatorSingle"
                    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
                    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" />

                <CheckedTextView
                    android:enabled="@{!isAddLimitMode}"
                    android:text="@string/manage_child_special_mode_wizard_disable_limits_option"
                    android:background="?selectableItemBackground"
                    android:id="@+id/disable_limits_option"
                    android:layout_width="match_parent"
                    android:layout_height="?android:attr/listPreferredItemHeightSmall"
                    android:textAppearance="?android:attr/textAppearanceListItemSmall"
                    android:gravity="center_vertical"
                    android:checkMark="?android:attr/listChoiceIndicatorSingle"
                    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
                    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" />

                <TextView
                    android:visibility="@{isAddLimitMode ? View.VISIBLE : View.GONE}"
                    android:textAppearance="?android:textAppearanceMedium"
                    android:padding="8dp"
                    android:text="@string/manage_disable_time_limits_toast_time_not_increased_but_child_mode"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />

                <TextView
                    android:padding="8dp"
                    android:textAppearance="?android:textAppearanceSmall"
                    android:text="@string/purchase_required_info_local_mode_free"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />

            </LinearLayout>

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/suggestion_list"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

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

                <DatePicker
                    android:layout_gravity="center_horizontal"
                    android:id="@+id/date_picker"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />

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

                    <Button
                        style="?borderlessButtonStyle"
                        android:layout_margin="8dp"
                        android:text="@string/manage_child_special_mode_wizard_time_of_day"
                        android:id="@+id/time_of_day_date_picker_button"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />

                    <View
                        android:layout_weight="1"
                        android:layout_width="0dp"
                        android:layout_height="1dp" />

                    <Button
                        android:layout_margin="8dp"
                        android:text="@string/generic_ok"
                        android:id="@+id/confirm_date_picker_button"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />

                </LinearLayout>

            </LinearLayout>

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

                <TimePicker
                    android:id="@+id/time_picker"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />

                <Button
                    android:layout_margin="8dp"
                    android:layout_gravity="end"
                    android:text="@string/generic_ok"
                    android:id="@+id/confirm_time_picker_button"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />

            </LinearLayout>

        </io.timelimit.android.ui.view.SafeViewFlipper>
    </LinearLayout>
</layout>