<?xml version="1.0" encoding="utf-8"?>
<!--
  TimeLimit Copyright <C> 2019 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">
    <data>
        <variable
            name="selectedDays"
            type="java.util.BitSet" />

        <variable
            name="handlers"
            type="io.timelimit.android.ui.view.SelectDayViewHandlers" />
    </data>

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

        <CheckBox
            android:onClick="@{() -> handlers.updateDayChecked(0)}"
            android:checked="@{safeUnbox(selectedDays.get(0))}"
            android:text="@string/day_of_week_monday"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <CheckBox
            android:onClick="@{() -> handlers.updateDayChecked(1)}"
            android:checked="@{safeUnbox(selectedDays.get(1))}"
            android:text="@string/day_of_week_tuesday"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <CheckBox
            android:onClick="@{() -> handlers.updateDayChecked(2)}"
            android:checked="@{safeUnbox(selectedDays.get(2))}"
            android:text="@string/day_of_week_wednesday"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <CheckBox
            android:onClick="@{() -> handlers.updateDayChecked(3)}"
            android:checked="@{safeUnbox(selectedDays.get(3))}"
            android:text="@string/day_of_week_thursday"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <CheckBox
            android:onClick="@{() -> handlers.updateDayChecked(4)}"
            android:checked="@{safeUnbox(selectedDays.get(4))}"
            android:text="@string/day_of_week_friday"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <CheckBox
            android:onClick="@{() -> handlers.updateDayChecked(5)}"
            android:checked="@{safeUnbox(selectedDays.get(5))}"
            android:text="@string/day_of_week_saturday"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <CheckBox
            android:onClick="@{() -> handlers.updateDayChecked(6)}"
            android:checked="@{safeUnbox(selectedDays.get(6))}"
            android:text="@string/day_of_week_sunday"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

    </LinearLayout>
</layout>