<!--
  ~ Copyright (C) 2016 Álinson Santos Xavier <isoron@gmail.com>
  ~
  ~ This file is part of Loop Habit Tracker.
  ~
  ~ Loop Habit Tracker 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, either version 3 of the License, or (at your
  ~ option) any later version.
  ~
  ~ Loop Habit Tracker 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 <http://www.gnu.org/licenses/>.
  -->

<LinearLayout
    android:id="@+id/container"
    style="@style/dialogForm"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".activities.habits.edit.BaseDialog"
    tools:ignore="MergeRootFrame">

    <LinearLayout
        android:id="@+id/formPanel"
        style="@style/dialogFormPanel">

        <LinearLayout
            android:id="@+id/namePanel"
            style="@style/dialogFormRow">

            <EditText
                android:id="@+id/tvName"
                style="@style/dialogFormInput"
                android:hint="@string/name">

                <requestFocus/>
            </EditText>

            <ImageButton
                android:id="@+id/buttonPickColor"
                style="@style/dialogFormInputColor"
                android:contentDescription="@string/color_picker_default_title"
                android:src="?dialogIconChangeColor"/>
        </LinearLayout>

        <EditText
            android:id="@+id/tvDescription"
            style="@style/dialogFormInputMultiline"
            android:hint="@string/description_hint"/>

        <LinearLayout
            style="@style/dialogFormRow">

            <TextView
                android:id="@+id/textView1"
                style="@style/dialogFormLabel"
                android:text="@string/repeat"/>

            <android.support.v7.widget.AppCompatSpinner
                android:id="@+id/sFrequency"
                android:theme="@style/dialogFormText"
                android:layout_width="wrap_content"
                android:layout_height="25dp"
                android:minWidth="400dp"
                android:entries="@array/frequencyQuickSelect"
                android:visibility="gone"/>

            <org.apmem.tools.layouts.FlowLayout
                android:id="@+id/llCustomFrequency"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:visibility="visible"
                android:gravity="fill">

                <EditText
                    android:id="@+id/tvFreqNum"
                    style="@style/dialogFormInputSmallNumber"/>

                <TextView
                    android:id="@+id/textView3"
                    style="@style/dialogFormText"
                    android:text="@string/times_every"
                    android:gravity="center"/>

                <EditText
                    android:id="@+id/tvFreqDen"
                    style="@style/dialogFormInputSmallNumber"/>

                <TextView
                    android:id="@+id/textView5"
                    style="@style/dialogFormText"
                    android:text="@string/days"
                    android:gravity="center_vertical"
                    android:paddingLeft="12dp"/>

            </org.apmem.tools.layouts.FlowLayout>
        </LinearLayout>

        <LinearLayout
            android:id="@+id/reminderPanel"
            style="@style/dialogFormRow">

            <TextView
                android:id="@+id/TextView2"
                style="@style/dialogFormLabel"
                android:text="@string/reminder"/>

            <TextView
                android:id="@+id/tvReminderTime"
                style="@style/dialogFormSpinner"/>
        </LinearLayout>

        <LinearLayout
            android:id="@+id/llReminderDays"
            style="@style/dialogFormRow">

            <TextView
                android:id="@+id/TextView3"
                style="@style/dialogFormLabel"
                android:text=""/>

            <TextView
                android:id="@+id/tvReminderDays"
                style="@style/dialogFormSpinner"/>

        </LinearLayout>
    </LinearLayout>

    <LinearLayout
        style="?android:attr/buttonBarStyle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="end"
        android:paddingEnd="16dp"
        android:paddingLeft="0dp"
        android:paddingRight="16dp"
        android:paddingStart="0dp">

        <Button
            android:id="@+id/buttonDiscard"
            style="?android:attr/buttonBarButtonStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/discard"/>

        <Button
            android:id="@+id/buttonSave"
            style="?android:attr/buttonBarButtonStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/save"/>
    </LinearLayout>
</LinearLayout>
