mirror of https://github.com/tasks/tasks
been updating task edit. just finished urgency... rest of stuff should be fast
parent
917cb8f7c4
commit
52d61e7bd0
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
@ -1,410 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
ASTRID: Android's Simple Task Recording Dashboard
|
||||
|
||||
Copyright (c) 2009 Tim Su
|
||||
|
||||
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; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
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, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
-->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/frame"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/tab_basic"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<LinearLayout android:id="@+id/event"
|
||||
android:paddingRight="8dip"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<TextView android:id="@+id/name_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/name_label"
|
||||
style="@style/TextAppearance.EditEvent_Label"/>
|
||||
|
||||
<EditText android:id="@+id/name"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/name_hint"
|
||||
android:autoText="true"
|
||||
android:capitalize="sentences"/>
|
||||
|
||||
<TextView android:id="@+id/importance_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/importance_label"
|
||||
style="@style/TextAppearance.EditEvent_Label"/>
|
||||
|
||||
<LinearLayout android:id="@+id/importance_container"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</LinearLayout>
|
||||
|
||||
<TextView android:id="@+id/tags_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/tags_label"
|
||||
style="@style/TextAppearance.EditEvent_Label"/>
|
||||
|
||||
<LinearLayout android:id="@+id/tags_container"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="5dip"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dip"
|
||||
android:background="@android:drawable/divider_horizontal_dark"
|
||||
/>
|
||||
|
||||
<TextView android:id="@+id/estimatedDuration_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/estimatedDuration_label"
|
||||
style="@style/TextAppearance.EditEvent_Label"/>
|
||||
|
||||
<Button android:id="@+id/estimatedDuration"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView android:id="@+id/notes_label"
|
||||
android:paddingTop="5dip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/notes_label"
|
||||
style="@style/TextAppearance.EditEvent_Label"/>
|
||||
|
||||
<EditText android:id="@+id/notes"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:scrollbars="vertical"
|
||||
android:gravity="top"
|
||||
android:hint="@string/notes_hint"
|
||||
android:autoText="true"
|
||||
android:capitalize="sentences"
|
||||
android:singleLine="false" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="5dip"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<Button android:id="@+id/save_general"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/save_label"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/discard_general"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/discard_label"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/delete_general"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/delete_label"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<!-- DATES -->
|
||||
<ScrollView
|
||||
android:id="@+id/tab_dates"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<LinearLayout android:id="@+id/event"
|
||||
android:paddingRight="8dip"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<TextView android:id="@+id/definiteDueDate_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/definiteDueDate_label"
|
||||
style="@style/TextAppearance.EditEvent_Label"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="10dip"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<CheckBox android:id="@+id/definiteDueDate_notnull"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<Button android:id="@+id/definiteDueDate_date"
|
||||
android:layout_weight="0.7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<Button android:id="@+id/definiteDueDate_time"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView android:id="@+id/preferredDueDate_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/preferredDueDate_label"
|
||||
style="@style/TextAppearance.EditEvent_Label"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="10dip"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<CheckBox android:id="@+id/preferredDueDate_notnull"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<Button android:id="@+id/preferredDueDate_date"
|
||||
android:layout_weight="0.7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<Button android:id="@+id/preferredDueDate_time"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox android:id="@+id/add_to_calendar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/addToCalendar_label"/>
|
||||
|
||||
<TextView android:id="@+id/hiddenUntil_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/hiddenUntil_label"
|
||||
style="@style/TextAppearance.EditEvent_Label"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="10dip"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<CheckBox android:id="@+id/hiddenUntil_notnull"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<Button android:id="@+id/hiddenUntil_date"
|
||||
android:layout_weight="0.7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<Button android:id="@+id/hiddenUntil_time"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView android:id="@+id/repeat_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/repeat_label"
|
||||
style="@style/TextAppearance.EditEvent_Label"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="10dip"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button android:id="@+id/repeat_value"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<Spinner android:id="@+id/repeat_interval"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dip"
|
||||
android:padding="5dip"
|
||||
android:background="@android:drawable/divider_horizontal_dark"
|
||||
/>
|
||||
|
||||
<TextView android:id="@+id/elapsedDuration_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/elapsedDuration_label"
|
||||
style="@style/TextAppearance.EditEvent_Label"/>
|
||||
|
||||
<Button android:id="@+id/elapsedDuration"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="5dip"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<Button android:id="@+id/save_dates"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/save_label"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/discard_dates"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/discard_label"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/delete_dates"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/delete_label"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/tab_notification"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<LinearLayout android:id="@+id/event"
|
||||
android:paddingRight="8dip"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<TextView android:id="@+id/notification_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/notification_label"
|
||||
style="@style/TextAppearance.EditEvent_Label"/>
|
||||
<Button android:id="@+id/notification"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView android:id="@+id/alerts_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/alerts_label"
|
||||
style="@style/TextAppearance.EditEvent_Label"/>
|
||||
|
||||
<LinearLayout android:id="@+id/alert_container"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</LinearLayout>
|
||||
|
||||
<Button android:id="@+id/addAlert"
|
||||
android:text="@string/add_alert"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
||||
<TextView android:id="@+id/flags_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/flags_label"
|
||||
style="@style/TextAppearance.EditEvent_Label"/>
|
||||
<CheckBox android:id="@+id/flag_before"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/flag_before"/>
|
||||
<CheckBox android:id="@+id/flag_during"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/flag_during"/>
|
||||
<CheckBox android:id="@+id/flag_after"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/flag_after"/>
|
||||
|
||||
<CheckBox android:id="@+id/flag_nonstop"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/flag_nonstop"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="5dip"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<Button android:id="@+id/save_notify"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/save_label"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/discard_notify"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/discard_label"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/delete_notify"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/delete_label"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</FrameLayout>
|
@ -1,126 +1,322 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
ASTRID: Android's Simple Task Recording Dashboard
|
||||
|
||||
Copyright (c) 2009 Tim Su
|
||||
|
||||
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; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
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, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
-->
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/background_gradient">
|
||||
|
||||
<!-- ======================================================= tab: basic == -->
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/tab_basic"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/background_gradient">
|
||||
|
||||
<LinearLayout android:id="@+id/event"
|
||||
android:paddingRight="8px"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="fill_parent">
|
||||
<LinearLayout
|
||||
android:id="@+id/event"
|
||||
android:paddingRight="8dip"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<!-- title -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/TEA_title_label"
|
||||
style="@style/TextAppearance.GEN_EditLabel" />
|
||||
<EditText
|
||||
android:id="@+id/title"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<TextView android:id="@+id/name_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/TEA_name_label"
|
||||
style="@style/TextAppearance.GEN_EditLabel"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/TEA_title_hint"
|
||||
android:autoText="true"
|
||||
android:capitalize="sentences" />
|
||||
|
||||
<EditText android:id="@+id/name"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/TEA_name_hint"
|
||||
android:autoText="true"
|
||||
android:capitalize="sentences"/>
|
||||
|
||||
<TextView android:id="@+id/importance_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/TEA_importance_label"
|
||||
style="@style/TextAppearance.GEN_EditLabel"/>
|
||||
<!-- importance -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/TEA_importance_label"
|
||||
style="@style/TextAppearance.GEN_EditLabel" />
|
||||
<LinearLayout
|
||||
android:id="@+id/importance_container"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/importance_container"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</LinearLayout>
|
||||
|
||||
<TextView android:id="@+id/urgency_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/TEA_urgency_label"
|
||||
style="@style/TextAppearance.GEN_EditLabel"/>
|
||||
|
||||
<Spinner android:id="@+id/urgency"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<Button android:id="@+id/fixedDate"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView android:id="@+id/hiddenUntil_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/TEA_hiddenUntil_label"
|
||||
style="@style/TextAppearance.GEN_EditLabel"/>
|
||||
<!-- urgency -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/TEA_urgency_label"
|
||||
style="@style/TextAppearance.GEN_EditLabel" />
|
||||
<Spinner
|
||||
android:id="@+id/urgency"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<!-- hide until -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/TEA_hideUntil_label"
|
||||
style="@style/TextAppearance.GEN_EditLabel" />
|
||||
<Spinner
|
||||
android:id="@+id/hideUntil"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<!-- notes -->
|
||||
<TextView
|
||||
android:paddingTop="5dip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/TEA_note_label"
|
||||
style="@style/TextAppearance.GEN_EditLabel" />
|
||||
<EditText
|
||||
android:id="@+id/notes"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:scrollbars="vertical"
|
||||
android:gravity="top"
|
||||
android:hint="@string/TEA_notes_hint"
|
||||
android:autoText="true"
|
||||
android:capitalize="sentences"
|
||||
android:singleLine="false" />
|
||||
|
||||
<!-- buttons -->
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="5dip"
|
||||
android:baselineAligned="false">
|
||||
<Button
|
||||
android:id="@+id/save_basic"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/TEA_save_label" />
|
||||
<Button
|
||||
android:id="@+id/discard_basic"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/TEA_cancel_label" />
|
||||
<Button
|
||||
android:id="@+id/delete_basic"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/TEA_delete_label" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<Button android:id="@+id/hiddenUntil"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
<!-- ======================================================= tab: extra == -->
|
||||
|
||||
<TextView android:id="@+id/plugins_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/TEA_plugins_label"
|
||||
android:visibility="gone"
|
||||
style="@style/TextAppearance.GEN_EditLabel"/>
|
||||
<ScrollView
|
||||
android:id="@+id/tab_extra"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<LinearLayout
|
||||
android:paddingRight="8dip"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<!-- reminders -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/TEA_reminder_label"
|
||||
style="@style/TextAppearance.GEN_EditLabel" />
|
||||
<CheckBox
|
||||
android:id="@+id/reminder_due"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/TEA_reminder_due" />
|
||||
<CheckBox
|
||||
android:id="@+id/reminder_overdue"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/TEA_reminder_overdue" />
|
||||
<CheckBox
|
||||
android:id="@+id/reminder_random"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/TEA_reminder_random" />
|
||||
|
||||
<LinearLayout android:id="@+id/plugins_container"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</LinearLayout>
|
||||
<!-- reminder mode -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/TEA_reminder_alarm_label"
|
||||
style="@style/TextAppearance.GEN_EditLabel" />
|
||||
<Spinner
|
||||
android:id="@+id/reminder_alarm"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dip"
|
||||
android:background="@drawable/black_white_gradient"
|
||||
/>
|
||||
<!-- separator -->
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dip"
|
||||
android:padding="5dip"
|
||||
android:background="@android:drawable/divider_horizontal_dark" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="5dip"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<Button android:id="@+id/save"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/TEA_save_label"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/discard"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/TEA_discard_label"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
<!-- tags -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/TEA_tags_label"
|
||||
style="@style/TextAppearance.GEN_EditLabel" />
|
||||
<LinearLayout
|
||||
android:id="@+id/tags_container"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="5dip"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dip"
|
||||
android:padding="5dip"
|
||||
android:background="@android:drawable/divider_horizontal_dark" />
|
||||
|
||||
<!-- repeat -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/repeat_label"
|
||||
style="@style/TextAppearance.GEN_EditLabel" />
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="10dip"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:id="@+id/repeat_value"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<Spinner
|
||||
android:id="@+id/repeat_interval"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- buttons -->
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="5dip"
|
||||
android:baselineAligned="false">
|
||||
<Button
|
||||
android:id="@+id/save_extra"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/save_label" />
|
||||
<Button
|
||||
android:id="@+id/discard_extra"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/discard_label" />
|
||||
<Button
|
||||
android:id="@+id/delete_extra"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/delete_label" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</ScrollView>
|
||||
|
||||
<!-- ===================================================== tab: add-ons == -->
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/tab_addons"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<LinearLayout
|
||||
android:paddingRight="8dip"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<!-- calendar integration -->
|
||||
<CheckBox
|
||||
android:id="@+id/add_to_calendar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/TEA_addToCalendar_label" />
|
||||
<Button
|
||||
android:id="@+id/view_calendar_event"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/TEA_showCalendar_label"
|
||||
android:visibility="gone" />
|
||||
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dip"
|
||||
android:padding="5dip"
|
||||
android:background="@android:drawable/divider_horizontal_dark" />
|
||||
|
||||
<!-- estimated time -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/TEA_estimatedDuration_label"
|
||||
style="@style/TextAppearance.GEN_EditLabel" />
|
||||
<Button
|
||||
android:id="@+id/estimatedDuration"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<!-- elapsed time -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/TEA_elapsedDuration_label"
|
||||
style="@style/TextAppearance.GEN_EditLabel" />
|
||||
<Button
|
||||
android:id="@+id/elapsedDuration"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="5dip"
|
||||
android:baselineAligned="false">
|
||||
<Button
|
||||
android:id="@+id/save_addons"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/save_label" />
|
||||
<Button
|
||||
android:id="@+id/discard_addons"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/discard_label" />
|
||||
<Button
|
||||
android:id="@+id/delete_addons"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/delete_label" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</FrameLayout>
|
@ -1,970 +0,0 @@
|
||||
/*
|
||||
* ASTRID: Android's Simple Task Recording Dashboard
|
||||
*
|
||||
* Copyright (c) 2009 Tim Su
|
||||
*
|
||||
* 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; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
package com.timsu.astrid.activities;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.SimpleCursorAdapter;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TabHost;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.ToggleButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
|
||||
import com.flurry.android.FlurryAgent;
|
||||
import com.timsu.astrid.R;
|
||||
import com.timsu.astrid.data.alerts.AlertController;
|
||||
import com.timsu.astrid.data.enums.Importance;
|
||||
import com.timsu.astrid.data.enums.RepeatInterval;
|
||||
import com.timsu.astrid.data.sync.SyncDataController;
|
||||
import com.timsu.astrid.data.tag.TagController;
|
||||
import com.timsu.astrid.data.tag.TagIdentifier;
|
||||
import com.timsu.astrid.data.tag.TagModelForView;
|
||||
import com.timsu.astrid.data.task.TaskIdentifier;
|
||||
import com.timsu.astrid.data.task.TaskModelForEdit;
|
||||
import com.timsu.astrid.data.task.TaskModelForList;
|
||||
import com.timsu.astrid.data.task.AbstractTaskModel.RepeatInfo;
|
||||
import com.timsu.astrid.utilities.AstridUtilities;
|
||||
import com.timsu.astrid.utilities.Constants;
|
||||
import com.timsu.astrid.utilities.DateUtilities;
|
||||
import com.timsu.astrid.utilities.Notifications;
|
||||
import com.timsu.astrid.utilities.Preferences;
|
||||
import com.timsu.astrid.widget.DateControlSet;
|
||||
import com.timsu.astrid.widget.DateWithNullControlSet;
|
||||
import com.timsu.astrid.widget.NumberPicker;
|
||||
import com.timsu.astrid.widget.NumberPickerDialog;
|
||||
import com.timsu.astrid.widget.TimeDurationControlSet;
|
||||
import com.timsu.astrid.widget.NumberPickerDialog.OnNumberPickedListener;
|
||||
import com.timsu.astrid.widget.TimeDurationControlSet.TimeDurationType;
|
||||
|
||||
/**
|
||||
* This activity is responsible for creating new tasks and editing existing
|
||||
* ones. It saves a task when it is paused (screen rotated, back button
|
||||
* pressed) as long as the task has a title.
|
||||
*
|
||||
* @author timsu
|
||||
*
|
||||
*/
|
||||
public class TaskEdit extends TaskModificationTabbedActivity<TaskModelForEdit> {
|
||||
|
||||
// bundle arguments
|
||||
public static final String TAG_NAME_TOKEN = "t";
|
||||
public static final String START_CHAR_TOKEN = "s";
|
||||
|
||||
// menu items
|
||||
private static final int SAVE_ID = Menu.FIRST;
|
||||
private static final int DISCARD_ID = Menu.FIRST + 1;
|
||||
private static final int DELETE_ID = Menu.FIRST + 2;
|
||||
|
||||
// other constants
|
||||
private static final int MAX_TAGS = 5;
|
||||
private static final int MAX_ALERTS = 5;
|
||||
private static final String TAB_BASIC = "basic";
|
||||
private static final String TAB_DATES = "dates";
|
||||
private static final String TAB_ALERTS = "alerts";
|
||||
private static final int DEFAULT_CAL_TIME = 3600;
|
||||
|
||||
// UI components
|
||||
private EditText name;
|
||||
private ImportanceControlSet importance;
|
||||
private TimeDurationControlSet estimatedDuration;
|
||||
private TimeDurationControlSet elapsedDuration;
|
||||
private TimeDurationControlSet notification;
|
||||
private DateControlSet definiteDueDate;
|
||||
private DateControlSet preferredDueDate;
|
||||
private DateControlSet hiddenUntil;
|
||||
private EditText notes;
|
||||
private LinearLayout tagsContainer;
|
||||
private NotifyFlagControlSet flags;
|
||||
private LinearLayout alertsContainer;
|
||||
private Button repeatValue;
|
||||
private Spinner repeatInterval;
|
||||
private CheckBox addToCalendar;
|
||||
|
||||
// other instance variables
|
||||
private boolean shouldSaveState = true;
|
||||
private boolean repeatHelpShown = false;
|
||||
private TagController tagController;
|
||||
private AlertController alertController;
|
||||
private List<TagModelForView> tags;
|
||||
private List<TagIdentifier> taskTags;
|
||||
|
||||
// OnClickListeners for save, discard and delete
|
||||
private View.OnClickListener mSaveListener = new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
saveButtonClick();
|
||||
}
|
||||
};
|
||||
private View.OnClickListener mDiscardListener = new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
discardButtonClick();
|
||||
}
|
||||
};
|
||||
private View.OnClickListener mDeleteListener = new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
deleteButtonClick();
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
tagController = new TagController(this);
|
||||
tagController.open();
|
||||
alertController = new AlertController(this);
|
||||
alertController.open();
|
||||
|
||||
TabHost tabHost = getTabHost();
|
||||
tabHost.setPadding(0, 4, 0, 0);
|
||||
Resources r = getResources();
|
||||
|
||||
LayoutInflater.from(this).inflate(R.layout.task_edit, tabHost.getTabContentView(), true);
|
||||
|
||||
tabHost.addTab(tabHost.newTabSpec(TAB_BASIC).setIndicator(r.getString(R.string.taskEdit_tab_basic),
|
||||
r.getDrawable(R.drawable.ic_dialog_info_c)).setContent(R.id.tab_basic));
|
||||
tabHost.addTab(tabHost.newTabSpec(TAB_DATES).setIndicator(r.getString(R.string.taskEdit_tab_dates),
|
||||
r.getDrawable(R.drawable.ic_dialog_time_c)).setContent(R.id.tab_dates));
|
||||
tabHost.addTab(tabHost.newTabSpec(TAB_ALERTS).setIndicator(r.getString(R.string.taskEdit_tab_alerts),
|
||||
r.getDrawable(R.drawable.ic_dialog_alert_c)).setContent(R.id.tab_notification));
|
||||
|
||||
setUpUIComponents();
|
||||
setUpListeners();
|
||||
|
||||
// disable name input box until user requests it
|
||||
AstridUtilities.suppressVirtualKeyboard(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TaskModelForEdit getModel(TaskIdentifier identifier) {
|
||||
if (identifier != null) {
|
||||
TaskModelForEdit task = controller.fetchTaskForEdit(this, identifier);
|
||||
if(task.getCursor().getCount() > 0)
|
||||
return task;
|
||||
}
|
||||
|
||||
return controller.createNewTaskForEdit();
|
||||
}
|
||||
|
||||
/* ======================================================================
|
||||
* =============================================== model reading / saving
|
||||
* ====================================================================== */
|
||||
|
||||
/** Populate UI component values from the model */
|
||||
private void populateFields() {
|
||||
Resources r = getResources();
|
||||
|
||||
// set UI components based on model variables
|
||||
if(model.getCursor() != null)
|
||||
startManagingCursor(model.getCursor());
|
||||
if(model.getTaskIdentifier() == null) {
|
||||
FlurryAgent.onEvent("create-task");
|
||||
Bundle extras = getIntent().getExtras();
|
||||
if(extras != null && extras.containsKey(START_CHAR_TOKEN))
|
||||
name.setText("" + extras.getChar(START_CHAR_TOKEN));
|
||||
} else {
|
||||
FlurryAgent.onEvent("edit-task");
|
||||
name.setText(model.getName());
|
||||
}
|
||||
|
||||
if(model.getName().length() > 0)
|
||||
setTitle(new StringBuilder().
|
||||
append(r.getString(R.string.taskEdit_titlePrefix)).
|
||||
append(" ").
|
||||
append(model.getName()));
|
||||
estimatedDuration.setTimeDuration(model.getEstimatedSeconds());
|
||||
elapsedDuration.setTimeDuration(model.getElapsedSeconds());
|
||||
importance.setImportance(model.getImportance());
|
||||
definiteDueDate.setDate(model.getDefiniteDueDate());
|
||||
preferredDueDate.setDate(model.getPreferredDueDate());
|
||||
hiddenUntil.setDate(model.getHiddenUntil());
|
||||
notification.setTimeDuration(model.getNotificationIntervalSeconds());
|
||||
flags.setValue(model.getNotificationFlags());
|
||||
notes.setText(model.getNotes());
|
||||
if(model.getTaskIdentifier() == null) {
|
||||
Integer reminder = Preferences.getDefaultReminder(this);
|
||||
if(reminder != null)
|
||||
notification.setTimeDuration(24*3600*reminder);
|
||||
}
|
||||
if(model.getCalendarUri() != null)
|
||||
addToCalendar.setText(r.getString(R.string.showCalendar_label));
|
||||
|
||||
// tags (only configure if not already set)
|
||||
if(tagsContainer.getChildCount() == 0) {
|
||||
tags = tagController.getAllTags();
|
||||
if(model.getTaskIdentifier() != null) {
|
||||
taskTags = tagController.getTaskTags(model.getTaskIdentifier());
|
||||
if(taskTags.size() > 0) {
|
||||
Map<TagIdentifier, TagModelForView> tagsMap =
|
||||
new HashMap<TagIdentifier, TagModelForView>();
|
||||
for(TagModelForView tag : tags)
|
||||
tagsMap.put(tag.getTagIdentifier(), tag);
|
||||
for(TagIdentifier id : taskTags) {
|
||||
if(!tagsMap.containsKey(id))
|
||||
continue;
|
||||
|
||||
TagModelForView tag = tagsMap.get(id);
|
||||
addTag(tag.getName());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
taskTags = new LinkedList<TagIdentifier>();
|
||||
|
||||
Bundle extras = getIntent().getExtras();
|
||||
if(extras != null && extras.containsKey(TAG_NAME_TOKEN)) {
|
||||
addTag(extras.getString(TAG_NAME_TOKEN));
|
||||
}
|
||||
}
|
||||
addTag("");
|
||||
}
|
||||
|
||||
// alerts
|
||||
if(model.getTaskIdentifier() != null) {
|
||||
List<Date> alerts = alertController.getTaskAlerts(model.getTaskIdentifier());
|
||||
for(Date alert : alerts) {
|
||||
addAlert(alert);
|
||||
}
|
||||
}
|
||||
|
||||
// repeats
|
||||
RepeatInfo repeatInfo = model.getRepeat();
|
||||
if(repeatInfo != null) {
|
||||
setRepeatValue(repeatInfo.getValue());
|
||||
repeatInterval.setSelection(repeatInfo.getInterval().ordinal());
|
||||
} else
|
||||
setRepeatValue(0);
|
||||
|
||||
}
|
||||
|
||||
/** Save task model from values in UI components */
|
||||
private void save() {
|
||||
// don't save if user accidentally created a new task
|
||||
if(name.getText().length() == 0)
|
||||
return;
|
||||
|
||||
// tell the task list to update itself
|
||||
TaskListSubActivity.shouldRefreshTaskList = true;
|
||||
|
||||
model.setName(name.getText().toString());
|
||||
model.setEstimatedSeconds(estimatedDuration.getTimeDurationInSeconds());
|
||||
model.setElapsedSeconds(elapsedDuration.getTimeDurationInSeconds());
|
||||
model.setImportance(importance.getImportance());
|
||||
model.setDefiniteDueDate(definiteDueDate.getDate());
|
||||
model.setPreferredDueDate(preferredDueDate.getDate());
|
||||
model.setHiddenUntil(hiddenUntil.getDate());
|
||||
model.setNotificationFlags(flags.getValue());
|
||||
model.setNotes(notes.getText().toString());
|
||||
model.setNotificationIntervalSeconds(notification.getTimeDurationInSeconds());
|
||||
model.setRepeat(getRepeatValue());
|
||||
|
||||
try {
|
||||
// write out to database
|
||||
controller.saveTask(model, false);
|
||||
saveTags();
|
||||
saveAlerts();
|
||||
Notifications.updateAlarm(this, controller, alertController, model);
|
||||
|
||||
Date dueDate = model.getPreferredDueDate();
|
||||
if (dueDate == null) {
|
||||
dueDate = model.getDefiniteDueDate();
|
||||
}
|
||||
if (dueDate != null && model.getProgressPercentage() != TaskModelForEdit.COMPLETE_PERCENTAGE) {
|
||||
showSaveToast(dueDate);
|
||||
} else {
|
||||
showSaveToast();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.e("astrid", "Error saving", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a Toast reporting that the selected task has been saved and is
|
||||
* due in 'x' amount of time, to 2 time-units of precision (e.g. Days + Hours).
|
||||
* @param dueDate the Date when the task is due
|
||||
*/
|
||||
private void showSaveToast(Date dueDate) {
|
||||
int stringResource;
|
||||
|
||||
int timeInSeconds = (int)((dueDate.getTime() - System.currentTimeMillis())/1000L);
|
||||
|
||||
if (timeInSeconds < 0) {
|
||||
timeInSeconds *= -1; // DateUtilities.getDurationString() requires positive integer
|
||||
stringResource = R.string.taskEdit_onTaskSave_Overdue;
|
||||
} else {
|
||||
stringResource = R.string.taskEdit_onTaskSave_Due;
|
||||
}
|
||||
String formattedDate = DateUtilities.getDurationString(getResources(), timeInSeconds, 2);
|
||||
Toast.makeText(this,
|
||||
getResources().getString(stringResource, formattedDate),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a Toast reporting that the selected task has been saved.
|
||||
* Use this version when no due Date has been set.
|
||||
*/
|
||||
private void showSaveToast() {
|
||||
Toast.makeText(this, R.string.taskEdit_onTaskSave_notDue, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
/** Save task tags. Must be called after task already has an ID */
|
||||
private void saveTags() {
|
||||
Set<TagIdentifier> tagsToDelete;
|
||||
Set<TagIdentifier> tagsToAdd;
|
||||
|
||||
HashSet<String> tagNames = new HashSet<String>();
|
||||
for(int i = 0; i < tagsContainer.getChildCount(); i++) {
|
||||
TextView tagName = (TextView)tagsContainer.getChildAt(i).findViewById(R.id.text1);
|
||||
if(tagName.getText().length() == 0)
|
||||
continue;
|
||||
tagNames.add(tagName.getText().toString());
|
||||
}
|
||||
|
||||
// map names to tag identifiers, creating them if necessary
|
||||
HashSet<TagIdentifier> tagIds = new HashSet<TagIdentifier>();
|
||||
HashMap<String, TagIdentifier> tagsByName = new HashMap<String, TagIdentifier>();
|
||||
for(TagModelForView tag : tags)
|
||||
tagsByName.put(tag.getName(), tag.getTagIdentifier());
|
||||
for(String tagName : tagNames) {
|
||||
if(tagsByName.containsKey(tagName))
|
||||
tagIds.add(tagsByName.get(tagName));
|
||||
else {
|
||||
TagIdentifier newTagId = tagController.createTag(tagName);
|
||||
tagIds.add(newTagId);
|
||||
}
|
||||
}
|
||||
|
||||
// intersect tags to figure out which we need to add / remove
|
||||
tagsToDelete = new HashSet<TagIdentifier>(taskTags);
|
||||
tagsToDelete.removeAll(tagIds);
|
||||
tagsToAdd = tagIds;
|
||||
tagsToAdd.removeAll(taskTags);
|
||||
|
||||
// perform the database updates
|
||||
for(TagIdentifier tagId : tagsToDelete)
|
||||
tagController.removeTag(model.getTaskIdentifier(), tagId);
|
||||
for(TagIdentifier tagId : tagsToAdd)
|
||||
tagController.addTag(model.getTaskIdentifier(), tagId);
|
||||
|
||||
if(tagsToDelete.size() > 0 || tagsToAdd.size() > 0)
|
||||
SyncDataController.taskUpdated(this, model);
|
||||
}
|
||||
|
||||
/** Helper method to save alerts for this task */
|
||||
private void saveAlerts() {
|
||||
alertController.removeAlerts(model.getTaskIdentifier());
|
||||
|
||||
for(int i = 0; i < alertsContainer.getChildCount(); i++) {
|
||||
DateControlSet dateControlSet = (DateControlSet)alertsContainer.
|
||||
getChildAt(i).getTag();
|
||||
Date date = dateControlSet.getDate();
|
||||
alertController.addAlert(model.getTaskIdentifier(), date);
|
||||
}
|
||||
}
|
||||
|
||||
/* ======================================================================
|
||||
* ==================================================== UI initialization
|
||||
* ====================================================================== */
|
||||
|
||||
/** Initialize UI components */
|
||||
private void setUpUIComponents() {
|
||||
Resources r = getResources();
|
||||
setTitle(new StringBuilder()
|
||||
.append(r.getString(R.string.taskEdit_titleGeneric)));
|
||||
|
||||
// populate instance variables
|
||||
name = (EditText)findViewById(R.id.name);
|
||||
importance = new ImportanceControlSet(R.id.importance_container);
|
||||
tagsContainer = (LinearLayout)findViewById(R.id.tags_container);
|
||||
estimatedDuration = new TimeDurationControlSet(this,
|
||||
R.id.estimatedDuration, 0, R.string.hour_minutes_dialog,
|
||||
TimeDurationType.HOURS_MINUTES);
|
||||
elapsedDuration = new TimeDurationControlSet(this, R.id.elapsedDuration,
|
||||
0, R.string.hour_minutes_dialog,
|
||||
TimeDurationType.HOURS_MINUTES);
|
||||
notification = new TimeDurationControlSet(this, R.id.notification,
|
||||
R.string.notification_prefix, R.string.notification_dialog,
|
||||
TimeDurationType.DAYS_HOURS);
|
||||
definiteDueDate = new DateWithNullControlSet(this, R.id.definiteDueDate_notnull,
|
||||
R.id.definiteDueDate_date, R.id.definiteDueDate_time);
|
||||
preferredDueDate = new DateWithNullControlSet(this, R.id.preferredDueDate_notnull,
|
||||
R.id.preferredDueDate_date, R.id.preferredDueDate_time);
|
||||
hiddenUntil = new DateWithNullControlSet(this, R.id.hiddenUntil_notnull,
|
||||
R.id.hiddenUntil_date, R.id.hiddenUntil_time);
|
||||
notes = (EditText)findViewById(R.id.notes);
|
||||
flags = new NotifyFlagControlSet(R.id.flag_before,
|
||||
R.id.flag_during, R.id.flag_after, R.id.flag_nonstop);
|
||||
alertsContainer = (LinearLayout)findViewById(R.id.alert_container);
|
||||
repeatInterval = (Spinner)findViewById(R.id.repeat_interval);
|
||||
repeatValue = (Button)findViewById(R.id.repeat_value);
|
||||
addToCalendar = (CheckBox)findViewById(R.id.add_to_calendar);
|
||||
|
||||
// individual ui component initialization
|
||||
ArrayAdapter<String> repeatAdapter = new ArrayAdapter<String>(
|
||||
this, android.R.layout.simple_spinner_item,
|
||||
RepeatInterval.getLabels(getResources()));
|
||||
repeatAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
repeatInterval.setAdapter(repeatAdapter);
|
||||
}
|
||||
|
||||
/** Set up button listeners */
|
||||
private void setUpListeners() {
|
||||
Button saveButtonGeneral = (Button) findViewById(R.id.save_general);
|
||||
saveButtonGeneral.setOnClickListener(mSaveListener);
|
||||
|
||||
Button saveButtonDates = (Button) findViewById(R.id.save_dates);
|
||||
saveButtonDates.setOnClickListener(mSaveListener);
|
||||
|
||||
Button saveButtonNotify = (Button) findViewById(R.id.save_notify);
|
||||
saveButtonNotify.setOnClickListener(mSaveListener);
|
||||
|
||||
Button discardButtonGeneral = (Button) findViewById(R.id.discard_general);
|
||||
discardButtonGeneral.setOnClickListener(mDiscardListener);
|
||||
|
||||
Button discardButtonDates = (Button) findViewById(R.id.discard_dates);
|
||||
discardButtonDates.setOnClickListener(mDiscardListener);
|
||||
|
||||
Button discardButtonNotify = (Button) findViewById(R.id.discard_notify);
|
||||
discardButtonNotify.setOnClickListener(mDiscardListener);
|
||||
|
||||
Button deleteButtonGeneral = (Button) findViewById(R.id.delete_general);
|
||||
Button deleteButtonDates = (Button) findViewById(R.id.delete_dates);
|
||||
Button deleteButtonNotify = (Button) findViewById(R.id.delete_notify);
|
||||
if(model.getTaskIdentifier() == null) {
|
||||
deleteButtonGeneral.setVisibility(View.GONE);
|
||||
deleteButtonDates.setVisibility(View.GONE);
|
||||
deleteButtonNotify.setVisibility(View.GONE);
|
||||
} else {
|
||||
deleteButtonGeneral.setOnClickListener(mDeleteListener);
|
||||
deleteButtonDates.setOnClickListener(mDeleteListener);
|
||||
deleteButtonNotify.setOnClickListener(mDeleteListener);
|
||||
}
|
||||
|
||||
Button addAlertButton = (Button) findViewById(R.id.addAlert);
|
||||
addAlertButton.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
addAlert(null);
|
||||
}
|
||||
});
|
||||
|
||||
repeatValue.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
repeatValueClick();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Set up the repeat value button */
|
||||
private void setRepeatValue(int value) {
|
||||
if(value == 0)
|
||||
repeatValue.setText(R.string.repeat_value_unset);
|
||||
else
|
||||
repeatValue.setText(Integer.toString(value));
|
||||
repeatValue.setTag(value);
|
||||
}
|
||||
|
||||
private RepeatInfo getRepeatValue() {
|
||||
if(repeatValue.getTag().equals(0))
|
||||
return null;
|
||||
return new RepeatInfo(RepeatInterval.values()
|
||||
[repeatInterval.getSelectedItemPosition()],
|
||||
(Integer)repeatValue.getTag());
|
||||
}
|
||||
|
||||
/** Adds an alert to the alert field */
|
||||
private boolean addAlert(Date alert) {
|
||||
if(alertsContainer.getChildCount() >= MAX_ALERTS)
|
||||
return false;
|
||||
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
final View alertItem = inflater.inflate(R.layout.edit_alert_item, null);
|
||||
alertsContainer.addView(alertItem);
|
||||
|
||||
DateControlSet dcs = new DateControlSet(this,
|
||||
(Button)alertItem.findViewById(R.id.date),
|
||||
(Button)alertItem.findViewById(R.id.time));
|
||||
dcs.setDate(alert);
|
||||
alertItem.setTag(dcs);
|
||||
|
||||
ImageButton reminderRemoveButton;
|
||||
reminderRemoveButton = (ImageButton)alertItem.findViewById(R.id.button1);
|
||||
reminderRemoveButton.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
alertsContainer.removeView(alertItem);
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Adds a tag to the tag field */
|
||||
private boolean addTag(String tagName) {
|
||||
if (tagsContainer.getChildCount() >= MAX_TAGS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
final View tagItem = inflater.inflate(R.layout.edit_tag_item, null);
|
||||
tagsContainer.addView(tagItem);
|
||||
|
||||
AutoCompleteTextView textView = (AutoCompleteTextView)tagItem.
|
||||
findViewById(R.id.text1);
|
||||
textView.setText(tagName);
|
||||
ArrayAdapter<TagModelForView> tagsAdapter =
|
||||
new ArrayAdapter<TagModelForView>(this,
|
||||
android.R.layout.simple_dropdown_item_1line, tags);
|
||||
textView.setAdapter(tagsAdapter);
|
||||
textView.addTextChangedListener(new TextWatcher() {
|
||||
public void onTextChanged(CharSequence s, int start, int before,
|
||||
int count) {
|
||||
if(start == 0 && tagsContainer.getChildAt(
|
||||
tagsContainer.getChildCount()-1) == tagItem) {
|
||||
addTag("");
|
||||
}
|
||||
}
|
||||
|
||||
public void afterTextChanged(Editable s) {
|
||||
//
|
||||
}
|
||||
|
||||
public void beforeTextChanged(CharSequence s, int start, int count,
|
||||
int after) {
|
||||
//
|
||||
}
|
||||
});
|
||||
|
||||
ImageButton reminderRemoveButton;
|
||||
reminderRemoveButton = (ImageButton)tagItem.findViewById(R.id.button1);
|
||||
reminderRemoveButton.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
tagsContainer.removeView(tagItem);
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ======================================================================
|
||||
* ======================================================= event handlers
|
||||
* ====================================================================== */
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
|
||||
if(hasFocus && TaskList.shouldCloseInstance) { // user wants to quit
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
private void saveButtonClick() {
|
||||
setResult(RESULT_OK);
|
||||
finish();
|
||||
}
|
||||
|
||||
private void discardButtonClick() {
|
||||
shouldSaveState = false;
|
||||
setResult(Constants.RESULT_DISCARD);
|
||||
finish();
|
||||
}
|
||||
|
||||
private void deleteButtonClick() {
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.delete_title)
|
||||
.setMessage(R.string.delete_this_task_title)
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.setPositiveButton(android.R.string.ok,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// tell the task list to update itself
|
||||
TaskListSubActivity.shouldRefreshTaskList = true;
|
||||
|
||||
controller.deleteTask(model.getTaskIdentifier());
|
||||
shouldSaveState = false;
|
||||
setResult(Constants.RESULT_GO_HOME);
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show();
|
||||
}
|
||||
|
||||
private void repeatValueClick() {
|
||||
final int tagValue = (Integer)repeatValue.getTag();
|
||||
if(tagValue > 0)
|
||||
repeatHelpShown = true;
|
||||
|
||||
final Runnable openDialogRunnable = new Runnable() {
|
||||
public void run() {
|
||||
repeatHelpShown = true;
|
||||
|
||||
int dialogValue = tagValue;
|
||||
if(dialogValue == 0)
|
||||
dialogValue = 1;
|
||||
|
||||
new NumberPickerDialog(TaskEdit.this, new OnNumberPickedListener() {
|
||||
public void onNumberPicked(NumberPicker view, int number) {
|
||||
setRepeatValue(number);
|
||||
}
|
||||
}, getResources().getString(R.string.repeat_picker_title),
|
||||
dialogValue, 1, 0, 31).show();
|
||||
}
|
||||
};
|
||||
|
||||
if(repeatHelpShown || !Preferences.shouldShowRepeatHelp(this)) {
|
||||
openDialogRunnable.run();
|
||||
return;
|
||||
}
|
||||
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.repeat_help_dialog_title)
|
||||
.setMessage(R.string.repeat_help_dialog)
|
||||
.setIcon(android.R.drawable.ic_dialog_info)
|
||||
.setPositiveButton(android.R.string.ok,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
openDialogRunnable.run();
|
||||
}
|
||||
})
|
||||
.setNeutralButton(R.string.repeat_help_hide,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Preferences.setShowRepeatHelp(TaskEdit.this, false);
|
||||
openDialogRunnable.run();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemSelected(int featureId, MenuItem item) {
|
||||
switch(item.getItemId()) {
|
||||
case SAVE_ID:
|
||||
saveButtonClick();
|
||||
return true;
|
||||
case DISCARD_ID:
|
||||
discardButtonClick();
|
||||
return true;
|
||||
case DELETE_ID:
|
||||
deleteButtonClick();
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onMenuItemSelected(featureId, item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
MenuItem item;
|
||||
|
||||
item = menu.add(Menu.NONE, SAVE_ID, 0, R.string.save_label);
|
||||
item.setIcon(android.R.drawable.ic_menu_save);
|
||||
item.setAlphabeticShortcut('s');
|
||||
|
||||
item = menu.add(Menu.NONE, DISCARD_ID, 0, R.string.discard_label);
|
||||
item.setIcon(android.R.drawable.ic_menu_close_clear_cancel);
|
||||
item.setAlphabeticShortcut('c');
|
||||
|
||||
if (model.getTaskIdentifier() != null) {
|
||||
item = menu.add(Menu.NONE, DELETE_ID, 0, R.string.delete_label);
|
||||
item.setIcon(android.R.drawable.ic_menu_delete);
|
||||
item.setAlphabeticShortcut('d');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
|
||||
// save the tag name token for when we rotate the screen
|
||||
Bundle extras = getIntent().getExtras();
|
||||
if(extras != null && extras.containsKey(TAG_NAME_TOKEN))
|
||||
outState.putString(TAG_NAME_TOKEN,
|
||||
extras.getString(TAG_NAME_TOKEN));
|
||||
}
|
||||
|
||||
/** Take the values from the model and set the calendar start and end times
|
||||
* based on these. Sets keys 'dtstart' and 'dtend'.
|
||||
*
|
||||
* @param preferred preferred due date or null
|
||||
* @param definite definite due date or null
|
||||
* @param estimatedSeconds estimated duration or null
|
||||
* @param values
|
||||
*/
|
||||
public static void createCalendarStartEndTimes(Date preferred, Date definite,
|
||||
Integer estimatedSeconds, ContentValues values) {
|
||||
FlurryAgent.onEvent("create-calendar-event");
|
||||
|
||||
Long deadlineDate = null;
|
||||
if (preferred != null && preferred.after(new Date()))
|
||||
deadlineDate = preferred.getTime();
|
||||
else if (definite != null)
|
||||
deadlineDate = definite.getTime();
|
||||
else
|
||||
deadlineDate = System.currentTimeMillis() + 24*3600*1000L;
|
||||
|
||||
int estimatedTime = DEFAULT_CAL_TIME;
|
||||
if(estimatedSeconds != null && estimatedSeconds > 0) {
|
||||
estimatedTime = estimatedSeconds;
|
||||
}
|
||||
values.put("dtstart", deadlineDate - estimatedTime * 1000L);
|
||||
values.put("dtend", deadlineDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
// create calendar event
|
||||
if(addToCalendar.isChecked() && model.getCalendarUri() == null) {
|
||||
|
||||
Uri uri = Uri.parse("content://calendar/events");
|
||||
ContentResolver cr = getContentResolver();
|
||||
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("title", name.getText().toString());
|
||||
values.put("calendar_id", Preferences.getDefaultCalendarIDSafe(this));
|
||||
values.put("description", notes.getText().toString());
|
||||
values.put("hasAlarm", 0);
|
||||
values.put("transparency", 0);
|
||||
values.put("visibility", 0);
|
||||
|
||||
createCalendarStartEndTimes(model.getPreferredDueDate(),
|
||||
model.getDefiniteDueDate(), model.getEstimatedSeconds(),
|
||||
values);
|
||||
|
||||
Uri result = null;
|
||||
try{
|
||||
result = cr.insert(uri, values);
|
||||
model.setCalendarUri(result.toString());
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.e("astrid", "Error creating calendar event!", e);
|
||||
}
|
||||
}
|
||||
|
||||
if(shouldSaveState)
|
||||
save();
|
||||
|
||||
if(addToCalendar.isChecked() && model.getCalendarUri() != null) {
|
||||
Uri result = Uri.parse(model.getCalendarUri());
|
||||
Intent intent = new Intent(Intent.ACTION_EDIT, result);
|
||||
|
||||
ContentValues values = new ContentValues();
|
||||
createCalendarStartEndTimes(model.getPreferredDueDate(),
|
||||
model.getDefiniteDueDate(), model.getEstimatedSeconds(),
|
||||
values);
|
||||
|
||||
intent.putExtra("beginTime", values.getAsLong("dtstart"));
|
||||
intent.putExtra("endTime", values.getAsLong("dtend"));
|
||||
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
populateFields();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
tagController.close();
|
||||
alertController.close();
|
||||
}
|
||||
|
||||
/* ======================================================================
|
||||
* ========================================== UI component helper classes
|
||||
* ====================================================================== */
|
||||
|
||||
/** Control set dealing with notification flags */
|
||||
public class NotifyFlagControlSet {
|
||||
private CheckBox before, during, after, nonstop;
|
||||
|
||||
public NotifyFlagControlSet(int beforeId, int duringId,
|
||||
int afterId, int nonstopId) {
|
||||
before = (CheckBox)findViewById(beforeId);
|
||||
during = (CheckBox)findViewById(duringId);
|
||||
after = (CheckBox)findViewById(afterId);
|
||||
nonstop = (CheckBox)findViewById(nonstopId);
|
||||
}
|
||||
|
||||
public void setValue(int flags) {
|
||||
before.setChecked((flags &
|
||||
TaskModelForEdit.NOTIFY_BEFORE_DEADLINE) > 0);
|
||||
during.setChecked((flags &
|
||||
TaskModelForEdit.NOTIFY_AT_DEADLINE) > 0);
|
||||
after.setChecked((flags &
|
||||
TaskModelForEdit.NOTIFY_AFTER_DEADLINE) > 0);
|
||||
nonstop.setChecked((flags &
|
||||
TaskModelForEdit.NOTIFY_NONSTOP) > 0);
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
int value = 0;
|
||||
if(before.isChecked())
|
||||
value |= TaskModelForEdit.NOTIFY_BEFORE_DEADLINE;
|
||||
if(during.isChecked())
|
||||
value |= TaskModelForEdit.NOTIFY_AT_DEADLINE;
|
||||
if(after.isChecked())
|
||||
value |= TaskModelForEdit.NOTIFY_AFTER_DEADLINE;
|
||||
if(nonstop.isChecked())
|
||||
value |= TaskModelForEdit.NOTIFY_NONSTOP;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/** Control set dealing with importance */
|
||||
public class ImportanceControlSet {
|
||||
private List<CompoundButton> buttons = new LinkedList<CompoundButton>();
|
||||
|
||||
public ImportanceControlSet(int containerId) {
|
||||
LinearLayout layout = (LinearLayout)findViewById(containerId);
|
||||
Resources r = getResources();
|
||||
|
||||
for(Importance i : Importance.values()) {
|
||||
final ToggleButton button = new ToggleButton(TaskEdit.this);
|
||||
button.setLayoutParams(new LinearLayout.LayoutParams(
|
||||
LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 1));
|
||||
button.setTextColor(r.getColor(i.getColorResource()));
|
||||
button.setTextOff(r.getString(i.getLabelResource()));
|
||||
button.setTextOn(r.getString(i.getLabelResource()));
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
setImportance((Importance)button.getTag());
|
||||
}
|
||||
});
|
||||
button.setTag(i);
|
||||
|
||||
buttons.add(button);
|
||||
layout.addView(button);
|
||||
}
|
||||
}
|
||||
|
||||
public void setImportance(Importance i) {
|
||||
for(CompoundButton b : buttons) {
|
||||
if(b.getTag() == i) {
|
||||
b.setTextSize(24);
|
||||
b.setChecked(true);
|
||||
} else {
|
||||
b.setTextSize(16);
|
||||
b.setChecked(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Importance getImportance() {
|
||||
for(CompoundButton b : buttons)
|
||||
if(b.isChecked())
|
||||
return (Importance)b.getTag();
|
||||
return Importance.DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
/** Control set dealing with "blocking on" */
|
||||
public class BlockingOnControlSet {
|
||||
|
||||
private CheckBox activatedCheckBox;
|
||||
private Spinner taskBox;
|
||||
|
||||
public BlockingOnControlSet(int checkBoxId, int taskBoxId) {
|
||||
activatedCheckBox = (CheckBox)findViewById(checkBoxId);
|
||||
taskBox = (Spinner)findViewById(taskBoxId);
|
||||
|
||||
Cursor tasks = controller.getActiveTaskListCursor();
|
||||
startManagingCursor(tasks);
|
||||
SimpleCursorAdapter tasksAdapter = new SimpleCursorAdapter(TaskEdit.this,
|
||||
android.R.layout.simple_list_item_1, tasks,
|
||||
new String[] { TaskModelForList.getNameField() },
|
||||
new int[] { android.R.id.text1 });
|
||||
taskBox.setAdapter(tasksAdapter);
|
||||
|
||||
activatedCheckBox.setOnCheckedChangeListener(
|
||||
new OnCheckedChangeListener() {
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
taskBox.setEnabled(isChecked);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void setBlockingOn(TaskIdentifier value) {
|
||||
activatedCheckBox.setChecked(value != null);
|
||||
if(value == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for(int i = 0; i < taskBox.getCount(); i++)
|
||||
if(taskBox.getItemIdAtPosition(i) == value.getId()) {
|
||||
taskBox.setSelection(i);
|
||||
return;
|
||||
}
|
||||
|
||||
// not found
|
||||
activatedCheckBox.setChecked(false);
|
||||
}
|
||||
|
||||
public TaskIdentifier getBlockingOn() {
|
||||
if(!activatedCheckBox.isChecked())
|
||||
return null;
|
||||
|
||||
return new TaskIdentifier(taskBox.getSelectedItemId());
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,68 @@
|
||||
task edit
|
||||
|
||||
<!-- title bar -->
|
||||
<string name="taskEdit_titleGeneric">Astrid: Editing Task</string>
|
||||
<string name="taskEdit_titlePrefix">Astrid: Editing </string>
|
||||
<string name="taskEdit_label">Astrid: New Task</string>
|
||||
|
||||
<!-- tabs -->
|
||||
<string name="taskEdit_tab_basic">Basic</string>
|
||||
<string name="taskEdit_tab_dates">Dates</string>
|
||||
<string name="taskEdit_tab_alerts">Alerts</string>
|
||||
|
||||
<!-- labels -->
|
||||
<string name="name_label">Summary</string>
|
||||
<string name="name_hint">Task Name</string>
|
||||
<string name="importance_label">How Important is it?</string>
|
||||
<string name="tags_label">Tags:</string>
|
||||
<string name="tag_hint">Tag Name</string>
|
||||
|
||||
<string name="estimatedDuration_label">How Long Will it Take?</string>
|
||||
<string name="elapsedDuration_label">Time Already Spent on Task</string>
|
||||
<string name="definiteDueDate_label">Absolute Deadline</string>
|
||||
<string name="preferredDueDate_label">Goal Deadline</string>
|
||||
<string name="addToCalendar_label">Add Task To Calendar</string>
|
||||
<string name="showCalendar_label">Open Calendar Event</string>
|
||||
<string name="hiddenUntil_label">Hide Until This Date</string>
|
||||
<string name="repeat_label">Repeat Every</string>
|
||||
<string name="repeat_value_unset">No Repeat Set</string>
|
||||
<string name="blockingOn_label">Hide Until This Task is Done</string>
|
||||
<string name="notes_label">Notes</string>
|
||||
<string name="notes_hint">Enter Task Notes</string>
|
||||
|
||||
<string name="notification_label">Periodic Reminders</string>
|
||||
<string name="notification_prefix">Every</string>
|
||||
<string name="flags_label">Notify me...</string>
|
||||
<string name="flag_before">As Deadlines Approach</string>
|
||||
<string name="flag_during">At Deadlines</string>
|
||||
<string name="flag_after">After Absolute Deadline Passes</string>
|
||||
<string name="flag_nonstop">Alarm Clock Mode</string>
|
||||
<string name="alerts_label">Fixed Reminders</string>
|
||||
<string name="add_alert">Add New Reminder</string>
|
||||
|
||||
<!-- dialog boxes -->
|
||||
<string name="hour_minutes_dialog">Time (hours : minutes)</string>
|
||||
<string name="notification_dialog">Remind Me Every</string>
|
||||
<string name="repeat_picker_title">Repeat Every (0 to disable)</string>
|
||||
<string name="repeat_help_dialog_title">Help: Astrid Repeats</string>
|
||||
<string name="repeat_help_dialog">
|
||||
To use repeats, set at least one of the deadlines above. When you complete this task, the deadline will be automatically advanced.
|
||||
\n\n
|
||||
If you don\'t want to see the new task right after you complete the old one, you should use the \"Hide Until\" field, which will also be advanced automatically.
|
||||
\n
|
||||
</string>
|
||||
<string name="repeat_help_hide">Don\'t Show Help Anymore</string>
|
||||
|
||||
<!-- buttons -->
|
||||
<string name="save_label">Save</string>
|
||||
<string name="discard_label">Discard</string>
|
||||
<string name="edit_label">Edit</string>
|
||||
<string name="delete_label">Delete</string>
|
||||
<string name="blank_button_title">Click to Set</string>
|
||||
<string name="startTimer_label">Start Timer</string>
|
||||
<string name="stopTimer_label">Stop Timer</string>
|
||||
|
||||
<string name="taskEdit_menu_save">Save</string>
|
||||
<string name="taskEdit_onTaskSave_Due">Task Saved: due in %s</string>
|
||||
<string name="taskEdit_onTaskSave_Overdue">Task Saved: due %s ago</string>
|
||||
<string name="taskEdit_onTaskSave_notDue">Task Saved</string>
|
Loading…
Reference in New Issue