<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<TableLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:stretchColumns="1"
    android:shrinkColumns="1">

    <!-- CALENDARS SELECTOR for new events -->
    <TableRow
        android:id="@+id/calendar_selector_group"
        android:gravity="center_vertical"
        android:focusable="true" >
        <TextView
            android:text="@string/edit_event_calendar_label"
            style="@style/TextAppearance.EditEvent_Label"
            android:gravity="center_vertical" />
            <LinearLayout
                android:id="@+id/calendar_selector_wrapper"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="12dip"
                android:layout_marginRight="12dip"
                android:focusable="true" >
                <Spinner
                    android:id="@+id/calendars_spinner"
                    style="@style/TextAppearance.EditEvent_Spinner"
                    android:layout_width="0dip"
                    android:layout_weight="1"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:layout_marginLeft="0dip"
                    android:layout_marginRight="0dip"
                    android:gravity="center_vertical"
                    android:prompt="@string/edit_event_calendar_label" />
                <ImageButton
                    android:id="@+id/change_color_new_event"
                    style="?android:attr/buttonBarButtonStyle"
                    android:src="@drawable/ic_menu_colorpicker_holo_dark"
                    android:contentDescription="@string/choose_event_color_label"
                    android:layout_width="48dip"
                    android:layout_height="48dip"
                    android:enabled="false"
                    android:layout_gravity="center_vertical"
                    android:padding="8dip"
                    android:scaleType="centerInside"
                    android:visibility="invisible" />
            </LinearLayout>
    </TableRow>

    <!-- CALENDAR DISPLAY for existing events -->
    <TableRow
        android:id="@+id/calendar_group"
        android:gravity="center_vertical"
        android:layout_marginBottom="8dip"
        android:focusable="true">
        <TextView
            android:text="@string/edit_event_calendar_label"
            style="@style/TextAppearance.EditEvent_Label" />
        <LinearLayout 
            android:id="@+id/calendar_textview_with_colorpicker"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="12dip"
            android:layout_marginRight="12dip" >
            <TextView
                android:id="@+id/calendar_textview"
                style="@style/TextAppearance.EditEvent_Value"
                android:layout_width="0dip"
                android:layout_weight="1"
                android:paddingLeft="12dip"
                android:paddingRight="12dip"
                android:layout_marginLeft="0dip"
                android:layout_marginRight="0dip"
                android:layout_height="wrap_content"
                android:minHeight="48dip"
                android:textColor="#FFFFFFFF" />
            <ImageButton
                android:id="@+id/change_color_existing_event"
                style="?android:attr/buttonBarButtonStyle"
                android:src="@drawable/ic_menu_colorpicker_holo_dark"
                android:contentDescription="@string/choose_event_color_label"
                android:layout_width="48dip"
                android:layout_height="48dip"
                android:enabled="false"
                android:layout_gravity="center_vertical"
                android:padding="8dip"
                android:scaleType="centerInside"
                android:visibility="gone"  />
        </LinearLayout>
    </TableRow>

    <!-- WHAT -->
    <TableRow>
        <TextView
            android:id="@+id/what_label"
            android:text="@string/what_label"
            style="@style/TextAppearance.EditEvent_Label" />
        <EditText
            android:id="@+id/title"
            style="@style/TextAppearance.EditEvent_Value"
            android:layout_width="wrap_content"
            android:hint="@string/hint_what"
            android:capitalize="sentences"
            android:inputType="textAutoCorrect|textCapSentences"
            android:focusable="true" />
    </TableRow>

    <!-- WHERE -->
    <TableRow android:id="@+id/where_row"
        android:focusable="true">
        <TextView
            android:text="@string/where_label"
            style="@style/TextAppearance.EditEvent_Label" />
        <AutoCompleteTextView
            android:id="@+id/location"
            android:singleLine="false"
            style="@style/TextAppearance.EditEvent_Value"
            android:inputType="textAutoCorrect|textCapSentences"
            android:hint="@string/hint_where" />
    </TableRow>

    <!-- WHEN - Read-only textview version of FROM/TO (below) -->
    <TableRow
        android:id="@+id/when_row"
        android:visibility="gone"
        android:focusable="true">
        <TextView
            android:id="@+id/when_label"
            android:text="@string/when_label"
            style="@style/TextAppearance.EditEvent_Label" />
        <TextView
            android:id="@+id/when"
            android:layout_marginLeft="24dip"
            android:layout_marginRight="24dip"
            style="@style/TextAppearance.EditEvent_Value" />
    </TableRow>

    <!-- FROM - Read/write version which launches the date/time pickers -->
    <TableRow
        android:id="@+id/from_row">
        <TextView
            android:id="@+id/from_label"
            android:text="@string/edit_event_from_label"
            style="@style/TextAppearance.EditEvent_Label" />
        <LinearLayout
            android:orientation="horizontal"
            android:animateLayoutChanges="false">
            <Button
                android:id="@+id/start_date"
                android:layout_width="0px"
                android:layout_height="wrap_content"
                android:layout_weight="7"
                android:contentDescription="@string/accessibility_pick_start_date"
                style="@style/TextAppearance.EditEvent_SpinnerButton" />
            <Button
                android:id="@+id/start_time"
                android:layout_width="0px"
                android:layout_height="wrap_content"
                android:layout_weight="4"
                android:contentDescription="@string/accessibility_pick_start_time"
                style="@style/TextAppearance.EditEvent_SpinnerButton" />
        </LinearLayout>
    </TableRow>
    <TableRow android:id="@+id/from_row_home_tz"
        android:visibility="gone"
        android:focusable="true">
        <TextView/>
        <LinearLayout android:orientation="horizontal"
            android:layout_marginLeft="16dip"
            android:layout_marginRight="16dip"
            android:paddingLeft="8dip"
            android:paddingRight="0dip"
            android:paddingBottom="5dip">
            <TextView android:id="@+id/start_date_home_tz"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="7"
                android:gravity="left|center_vertical"
                style="@style/TextAppearance.EditEvent_homeTime" />
            <TextView android:id="@+id/start_time_home_tz"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="4"
                android:gravity="right|center_vertical"
                style="@style/TextAppearance.EditEvent_homeTime" />
        </LinearLayout>
    </TableRow>

    <!-- TO - Read/write version which launches the date/time pickers -->
    <TableRow
        android:id="@+id/to_row">
        <TextView
            android:id="@+id/to_label"
            android:text="@string/edit_event_to_label"
            style="@style/TextAppearance.EditEvent_Label" />
        <LinearLayout
            android:orientation="horizontal"
            android:animateLayoutChanges="false">
            <Button
                android:id="@+id/end_date"
                android:layout_width="0px"
                android:layout_height="wrap_content"
                android:layout_weight="7"
                android:contentDescription="@string/accessibility_pick_end_date"
                style="@style/TextAppearance.EditEvent_SpinnerButton" />
            <Button
                android:id="@+id/end_time"
                android:layout_width="0px"
                android:layout_height="wrap_content"
                android:layout_weight="4"
                android:contentDescription="@string/accessibility_pick_end_time"
                style="@style/TextAppearance.EditEvent_SpinnerButton" />
        </LinearLayout>
    </TableRow>
    <TableRow android:id="@+id/to_row_home_tz"
        android:visibility="gone"
        android:focusable="true">
        <TextView/>
        <LinearLayout android:orientation="horizontal"
            android:layout_marginLeft="16dip"
            android:layout_marginRight="16dip"
            android:paddingLeft="8dip"
            android:paddingRight="0dip"
            android:paddingBottom="5dip">
            <TextView android:id="@+id/end_date_home_tz"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="7"
                android:gravity="left|center_vertical"
                style="@style/TextAppearance.EditEvent_homeTime" />
            <TextView android:id="@+id/end_time_home_tz"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="4"
                android:gravity="right|center_vertical"
                style="@style/TextAppearance.EditEvent_homeTime" />
        </LinearLayout>
    </TableRow>

    <!-- TIME ZONE - Read-only textview version -->
    <TableRow
        android:id="@+id/timezone_textview_row"
        android:visibility="gone"
        android:focusable="true">
        <TextView
            android:text="@string/timezone_label"
            style="@style/TextAppearance.EditEvent_Label" />
        <TextView
            android:id="@+id/timezone_textView"
            android:layout_marginLeft="24dip"
            android:layout_marginRight="24dip"
            style="@style/TextAppearance.EditEvent_Value" />
    </TableRow>

    <!-- ALL DAY -->
    <TableRow
        android:id="@+id/all_day_row">
        <TextView
            android:id="@+id/is_all_day_label"
            android:text="@string/edit_event_all_day_label"
            style="@style/TextAppearance.EditEvent_Label"
            android:layout_height="match_parent" />
        <CheckBox
            android:id="@+id/is_all_day"
            android:layout_height="match_parent"
            android:layout_gravity="center_vertical"
            android:layout_marginLeft="16dip"
            android:paddingLeft="8dip"
            android:contentDescription="@string/accessibility_all_day"
            android:gravity="center_vertical" />
    </TableRow>

    <!-- TIME ZONE - Read/write version with button to launch picker -->
    <TableRow
        android:id="@+id/timezone_button_row">
        <TextView
            android:id="@+id/timezone_label"
            android:text="@string/timezone_label"
            style="@style/TextAppearance.EditEvent_Label" />
        <Button
            android:id="@+id/timezone_button"
            android:gravity="left|center_vertical"
            android:contentDescription="@string/accessibility_pick_time_zone"
            style="@style/TextAppearance.EditEvent_SpinnerButton" />
    </TableRow>

    <!-- RESPONSE -->
    <TableRow
        android:id="@+id/response_row"
        android:focusable="true">
        <TextView
            android:id="@+id/response_label"
            android:text="@string/view_event_response_label"
            android:gravity="center_vertical"
            style="@style/TextAppearance.EditEvent_Label" />
        <RadioGroup
            android:id="@+id/response_value"
            android:orientation="horizontal"
            android:layout_marginLeft="16dip"
            android:layout_marginRight="8dip"
            android:paddingTop="11dip">
            <RadioButton
                android:id="@+id/response_yes"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:maxWidth="128dip"
                android:layout_weight="1"
                android:gravity="center_vertical"
                style="@style/TextAppearance.EditEvent"
                android:text="@string/response_yes" />
            <RadioButton
                android:id="@+id/response_maybe"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:maxWidth="128dip"
                android:layout_weight="1"
                android:gravity="center_vertical"
                style="@style/TextAppearance.EditEvent"
                android:text="@string/response_maybe" />
            <RadioButton
                android:id="@+id/response_no"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:maxWidth="128dip"
                android:layout_weight="1"
                android:gravity="center_vertical"
                style="@style/TextAppearance.EditEvent"
                android:text="@string/response_no" />
        </RadioGroup>
    </TableRow>
    <TableRow
        android:id="@+id/organizer_row"
        android:focusable="true">
        <TextView
            android:id="@+id/organizer_label"
            android:text="@string/view_event_organizer_label"
            style="@style/TextAppearance.EditEvent_Label" />
        <TextView
            android:id="@+id/organizer"
            style="@style/TextAppearance.EditEvent_Value" />
    </TableRow>
    <TableRow
        android:id="@+id/add_attendees_row">
        <TextView
            android:id="@+id/add_attendees_label"
            android:text="@string/attendees_label"
            style="@style/TextAppearance.EditEvent_Label" />
        <com.android.ex.chips.RecipientEditTextView
            android:id="@+id/attendees"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:inputType="textEmailAddress|textMultiLine|textCapWords"
            android:hint="@string/hint_attendees"
            android:imeOptions="actionNext"
            style="@style/TextAppearance.EditEvent_Value" />
    </TableRow>

    <!-- DESCRIPTION -->
    <TableRow android:id="@+id/description_row"
        android:focusable="true">
        <TextView
            android:id="@+id/description_label"
            android:text="@string/description_label"
            style="@style/TextAppearance.EditEvent_Label" />
        <EditText
            android:id="@+id/description"
            android:layout_width="wrap_content"
            android:hint="@string/hint_description"
            android:inputType="textAutoCorrect|textCapSentences|textMultiLine"
            style="@style/TextAppearance.EditEvent_Value"
            android:capitalize="sentences" />
    </TableRow>

    <!-- REPEATS -->
    <TableRow
        android:focusable="true">
        <TextView
            android:id="@+id/repeats_label"
            android:text="@string/repeats_label"
            android:layout_gravity="top|left"
            style="@style/TextAppearance.EditEvent_Label" />
        <Button
            android:id="@+id/rrule"
            android:text="@string/does_not_repeat"
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:gravity="left|center_vertical"
            android:contentDescription="@string/accessibility_pick_recurrence"
            style="@style/TextAppearance.EditEvent_SpinnerButton" />
    </TableRow>

    <!-- REMINDERS -->
    <TableRow
        android:id="@+id/reminders_row"
        android:focusable="true">
        <TextView
            android:id="@+id/reminders_group_label"
            android:text="@string/event_info_reminders_label"
            android:layout_gravity="top|left"
            style="@style/TextAppearance.EditEvent_Label" />
        <LinearLayout
            android:orientation="vertical"
            android:gravity="center_vertical|right"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <LinearLayout
                android:id="@+id/reminder_items_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="8dip"
                android:orientation="vertical"
                android:gravity="center_vertical|right"  />
            <Button
                android:id="@+id/reminder_add"
                android:text="@string/reminders_label"
                android:layout_height="wrap_content"
                android:layout_width="match_parent"
                android:background="?android:attr/selectableItemBackground"
                android:layout_gravity="top|left"
                android:contentDescription="@string/accessibility_add_reminder"
                style="@style/TextAppearance.EditEvent_Button"
                android:layout_marginTop="0dip" />
        </LinearLayout>
    </TableRow>

    <!-- PRESENCE - Show me as [busy | available] -->
    <TableRow
        android:id="@+id/availability_row">
        <TextView
            android:id="@+id/presence_label"
            android:text="@string/presence_label"
            style="@style/TextAppearance.EditEvent_Label" />
        <Spinner
            android:id="@+id/availability"
            android:entries="@array/availability"
            style="@style/TextAppearance.EditEvent_Spinner"
            android:prompt="@string/presence_label" />
    </TableRow>

    <!-- PRIVACY -->
    <TableRow
        android:id="@+id/visibility_row">
        <TextView
            android:id="@+id/privacy_label"
            android:text="@string/privacy_label"
            style="@style/TextAppearance.EditEvent_Label" />
        <Spinner
            android:id="@+id/visibility"
            android:entries="@array/visibility"
            style="@style/TextAppearance.EditEvent_Spinner"
            android:prompt="@string/privacy_label" />
    </TableRow>

</TableLayout>