<?xml version="1.0" encoding="utf-8"?>
<!--
  TimeLimit Copyright <C> 2019 - 2021 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:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <data>
        <variable
            name="errorsText"
            type="String" />

        <variable
            name="warningsText"
            type="String" />

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

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

    <androidx.core.widget.NestedScrollView
        android:id="@+id/scroll"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <LinearLayout
            android:padding="8dp"
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <androidx.appcompat.widget.SwitchCompat
                android:id="@+id/enable_switch"
                android:text="@string/category_notifications_filter_checkbox"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <TextView
                android:textAppearance="?android:textAppearanceSmall"
                android:text="@string/category_notification_filter_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <TextView
                android:visibility="@{TextUtils.isEmpty(errorsText) ? View.GONE : View.VISIBLE}"
                android:textAppearance="?android:textAppearanceMedium"
                android:textColor="@color/text_red"
                android:text="@{errorsText}"
                tools:text="@string/category_notification_filter_error_premium"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <TextView
                android:visibility="@{TextUtils.isEmpty(warningsText) ? View.GONE : View.VISIBLE}"
                android:textAppearance="?android:textAppearanceMedium"
                android:textColor="@color/orange_text"
                android:text="@{warningsText}"
                tools:text="@string/category_notification_filter_missing_permission"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <View
                android:layout_marginVertical="8dp"
                android:background="?colorAccent"
                android:layout_width="match_parent"
                android:layout_height="1px" />

            <androidx.appcompat.widget.SwitchCompat
                android:id="@+id/delay_switch"
                android:text="@string/category_notification_filter_delay_switch"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <TextView
                android:textAppearance="?android:textAppearanceSmall"
                android:text="@string/category_notification_filter_delay_intro"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <LinearLayout
                android:visibility="@{showDelayPicker ? View.VISIBLE : View.GONE}"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <TextView
                    android:textAppearance="?android:textAppearanceMedium"
                    android:layout_gravity="center_vertical"
                    android:text="@string/category_notification_filter_delay_prefix"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />

                <NumberPicker
                    android:id="@+id/delay_picker"
                    android:layout_marginHorizontal="16dp"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />

                <TextView
                    android:textAppearance="?android:textAppearanceMedium"
                    android:layout_gravity="center_vertical"
                    android:text="@string/category_notification_filter_delay_suffix"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />

            </LinearLayout>

            <Button
                android:text="@string/generic_save"
                android:layout_gravity="end"
                android:id="@+id/save_btn"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <TextView
                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.core.widget.NestedScrollView>
</layout>