<?xml version="1.0" encoding="utf-8"?>
<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">

    <com.google.android.material.appbar.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/AppTheme.AppBarOverlay"
            android:fitsSystemWindows="true">

        <org.autojs.autojs.theme.widget.ThemeColorToolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="?attr/colorPrimary"
                android:theme="@style/ToolBarStyle"
                app:popupTheme="@style/AppTheme.PopupOverlay" />

    </com.google.android.material.appbar.AppBarLayout>

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

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

            <androidx.cardview.widget.CardView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="6dp"
                    android:layout_marginTop="12dp"
                    android:layout_marginEnd="6dp"
                    app:cardCornerRadius="2dp"
                    app:cardElevation="1dp"
                    app:cardUseCompatPadding="true">

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

                    <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginBottom="16dp"
                            android:text="@string/text_timed_task_timing"
                            android:textAppearance="@style/TextAppearance.AppCompat.Body2"
                            android:textColor="?android:textColorSecondary" />

                    <RadioGroup
                            android:id="@+id/timing_group"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content">

                        <RadioButton
                                android:id="@+id/daily_task_radio"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:layout_marginTop="16dp"
                                android:paddingStart="16dp"
                                android:text="@string/text_daily_task"
                                tools:ignore="RtlSymmetry" />

                        <com.github.aakira.expandablelayout.ExpandableRelativeLayout
                                android:id="@+id/daily_task_relative_layout"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                app:ael_expanded="false"
                                app:ael_interpolator="fastOutSlowIn"
                                app:ael_orientation="vertical">

                            <TimePicker
                                    android:id="@+id/daily_task_time_picker"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:timePickerMode="spinner" />

                        </com.github.aakira.expandablelayout.ExpandableRelativeLayout>

                        <RadioButton
                                android:id="@+id/disposable_task_radio"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:layout_marginTop="16dp"
                                android:paddingStart="16dp"
                                android:text="@string/text_disposable_task"
                                tools:ignore="RtlSymmetry" />

                        <com.github.aakira.expandablelayout.ExpandableRelativeLayout
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:layout_marginStart="36dp"
                                app:ael_expanded="false"
                                app:ael_interpolator="fastOutSlowIn"
                                app:ael_orientation="vertical">

                            <LinearLayout
                                    android:id="@+id/disposable_task_time_container"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:layout_alignParentTop="true"
                                    android:background="?selectableItemBackground"
                                    android:gravity="center_vertical"
                                    android:orientation="horizontal"
                                    android:paddingTop="6dp"
                                    android:paddingBottom="6dp">

                                <org.autojs.autojs.theme.widget.ThemeColorImageViewCompat
                                        android:layout_width="24dp"
                                        android:layout_height="24dp"
                                        android:layout_gravity="center_vertical"
                                        android:gravity="center"
                                        android:src="@drawable/ic_schedule_black_48dp" />

                                <TextView
                                        android:id="@+id/disposable_task_time"
                                        android:layout_width="match_parent"
                                        android:layout_height="36dp"
                                        android:layout_marginStart="12dp"
                                        android:gravity="center_vertical"
                                        android:textColor="?android:textColorPrimary"
                                        android:textSize="16sp" />
                            </LinearLayout>

                            <LinearLayout
                                    android:id="@+id/disposable_task_date_container"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:layout_below="@+id/disposable_task_time_container"
                                    android:layout_alignParentBottom="true"
                                    android:background="?selectableItemBackground"
                                    android:gravity="center_vertical"
                                    android:orientation="horizontal"
                                    android:paddingTop="6dp">

                                <org.autojs.autojs.theme.widget.ThemeColorImageViewCompat
                                        android:id="@+id/disposable_task_date_icon"
                                        android:layout_width="24dp"
                                        android:layout_height="24dp"
                                        android:layout_gravity="center_vertical"
                                        android:gravity="center"
                                        android:src="@drawable/ic_date_range_black_48dp" />

                                <TextView
                                        android:id="@+id/disposable_task_date"
                                        android:layout_width="match_parent"
                                        android:layout_height="36dp"
                                        android:layout_marginStart="12dp"
                                        android:gravity="center_vertical"
                                        android:textColor="?android:textColorPrimary"
                                        android:textSize="16sp" />
                            </LinearLayout>

                        </com.github.aakira.expandablelayout.ExpandableRelativeLayout>

                        <RadioButton
                                android:id="@+id/weekly_task_radio"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:layout_marginTop="16dp"
                                android:paddingStart="16dp"
                                android:text="@string/text_weekly_task"
                                tools:ignore="RtlSymmetry" />

                        <com.github.aakira.expandablelayout.ExpandableRelativeLayout
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                app:ael_expanded="false"
                                app:ael_interpolator="fastOutSlowIn"
                                app:ael_orientation="vertical">

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

                                <TimePicker
                                        android:id="@+id/weekly_task_time_picker"
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content"
                                        android:timePickerMode="spinner" />


                                <LinearLayout
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content"
                                        android:layout_marginStart="25dp"
                                        android:orientation="horizontal"
                                        android:weightSum="4">

                                    <CheckBox
                                            android:layout_width="0dp"
                                            android:layout_height="wrap_content"
                                            android:layout_weight="1"
                                            android:text="@string/text_day1"
                                            tools:ignore="TooDeepLayout" />

                                    <CheckBox
                                            android:layout_width="0dp"
                                            android:layout_height="wrap_content"
                                            android:layout_weight="1"
                                            android:text="@string/text_day2" />

                                    <CheckBox
                                            android:layout_width="0dp"
                                            android:layout_height="wrap_content"
                                            android:layout_weight="1"
                                            android:text="@string/text_day3" />

                                    <CheckBox
                                            android:layout_width="0dp"
                                            android:layout_height="wrap_content"
                                            android:layout_weight="1"
                                            android:text="@string/text_day4" />
                                </LinearLayout>


                                <LinearLayout
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content"
                                        android:layout_marginStart="25dp"
                                        android:orientation="horizontal"
                                        android:weightSum="4">

                                    <CheckBox
                                            android:layout_width="0dp"
                                            android:layout_height="wrap_content"
                                            android:layout_weight="1"
                                            android:text="@string/text_day5" />

                                    <CheckBox
                                            android:layout_width="0dp"
                                            android:layout_height="wrap_content"
                                            android:layout_weight="1"
                                            android:text="@string/text_day6" />

                                    <CheckBox
                                            android:layout_width="0dp"
                                            android:layout_height="wrap_content"
                                            android:layout_weight="1"
                                            android:text="@string/text_day7" />

                                </LinearLayout>

                            </LinearLayout>


                        </com.github.aakira.expandablelayout.ExpandableRelativeLayout>

                        <RadioButton
                                android:id="@+id/run_on_broadcast"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:layout_marginTop="16dp"
                                android:paddingStart="16dp"
                                android:text="@string/text_broadcast_task"
                                tools:ignore="RtlSymmetry" />

                        <com.github.aakira.expandablelayout.ExpandableRelativeLayout
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                app:ael_expanded="false"
                                app:ael_interpolator="fastOutSlowIn"
                                app:ael_orientation="vertical">

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

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

                                    <RadioButton
                                            android:id="@+id/run_on_startup"
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:layout_marginTop="16dp"
                                            android:paddingStart="8dp"
                                            android:text="@string/text_run_on_startup"
                                            tools:ignore="RtlSymmetry" />

                                    <RadioButton
                                            android:id="@+id/run_on_boot"
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:layout_marginTop="16dp"
                                            android:paddingStart="8dp"
                                            android:text="@string/text_run_on_boot"
                                            tools:ignore="RtlSymmetry" />

                                    <RadioButton
                                            android:id="@+id/run_on_screen_on"
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:layout_marginTop="16dp"
                                            android:paddingStart="8dp"
                                            android:text="@string/text_run_on_screen_on"
                                            tools:ignore="RtlSymmetry" />

                                    <RadioButton
                                            android:id="@+id/run_on_screen_off"
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:layout_marginTop="16dp"
                                            android:paddingStart="8dp"
                                            android:text="@string/text_run_on_screen_off"
                                            tools:ignore="RtlSymmetry" />

                                    <RadioButton
                                            android:id="@+id/run_on_screen_unlock"
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:layout_marginTop="16dp"
                                            android:paddingStart="8dp"
                                            android:text="@string/text_run_on_screen_unlock"
                                            tools:ignore="RtlSymmetry" />

                                    <RadioButton
                                            android:id="@+id/run_on_battery_change"
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:layout_marginTop="16dp"
                                            android:paddingStart="8dp"
                                            android:text="@string/text_run_on_battery_change"
                                            tools:ignore="RtlSymmetry" />

                                    <RadioButton
                                            android:id="@+id/run_on_power_connect"
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:layout_marginTop="16dp"
                                            android:paddingStart="8dp"
                                            android:text="@string/text_run_on_power_connect"
                                            tools:ignore="RtlSymmetry" />

                                    <RadioButton
                                            android:id="@+id/run_on_power_disconnect"
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:layout_marginTop="16dp"
                                            android:paddingStart="8dp"
                                            android:text="@string/text_run_on_power_disconnect"
                                            tools:ignore="RtlSymmetry" />

                                    <RadioButton
                                            android:id="@+id/run_on_conn_change"
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:layout_marginTop="16dp"
                                            android:paddingStart="8dp"
                                            android:text="@string/text_run_on_conn_change"
                                            tools:ignore="RtlSymmetry" />

                                    <RadioButton
                                            android:id="@+id/run_on_package_install"
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:layout_marginTop="16dp"
                                            android:paddingStart="8dp"
                                            android:text="@string/text_run_on_package_install"
                                            tools:ignore="RtlSymmetry" />

                                    <RadioButton
                                            android:id="@+id/run_on_package_uninstall"
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:layout_marginTop="16dp"
                                            android:paddingStart="8dp"
                                            android:text="@string/text_run_on_package_uninstall"
                                            tools:ignore="RtlSymmetry" />

                                    <RadioButton
                                            android:id="@+id/run_on_package_update"
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:layout_marginTop="16dp"
                                            android:paddingStart="8dp"
                                            android:text="@string/text_run_on_package_update"
                                            tools:ignore="RtlSymmetry" />

                                    <RadioButton
                                            android:id="@+id/run_on_headset_plug"
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:layout_marginTop="16dp"
                                            android:paddingStart="8dp"
                                            android:text="@string/text_run_on_headset_plug"
                                            tools:ignore="RtlSymmetry" />

                                    <RadioButton
                                            android:id="@+id/run_on_config_change"
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:layout_marginTop="16dp"
                                            android:paddingStart="8dp"
                                            android:text="@string/text_run_on_config_change"
                                            tools:ignore="RtlSymmetry" />

                                    <RadioButton
                                            android:id="@+id/run_on_time_tick"
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:layout_marginTop="16dp"
                                            android:paddingStart="8dp"
                                            android:text="@string/text_run_on_time_tick"
                                            tools:ignore="RtlSymmetry" />

                                    <RadioButton
                                            android:id="@+id/run_on_other_broadcast"
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:layout_marginTop="16dp"
                                            android:paddingStart="8dp"
                                            android:text="@string/text_run_on_user_defined_broadcast"
                                            tools:ignore="RtlSymmetry" />

                                </RadioGroup>

                                <com.google.android.material.textfield.TextInputLayout
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content"
                                        android:layout_marginStart="36dp"
                                        android:layout_marginTop="2dp"
                                        android:hint="@string/text_broadcast_action">


                                    <androidx.appcompat.widget.AppCompatEditText
                                            android:id="@+id/action"
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:maxLines="2"
                                            android:text="@string/text_broadcast_action_prefix" />

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

                            </LinearLayout>

                        </com.github.aakira.expandablelayout.ExpandableRelativeLayout>

                    </RadioGroup>

                </LinearLayout>

            </androidx.cardview.widget.CardView>

        </LinearLayout>

    </ScrollView>

</LinearLayout>