diff --git a/api/src/com/todoroo/andlib/data/DatabaseDao.java b/api/src/com/todoroo/andlib/data/DatabaseDao.java index 8ee776d7f..12aba2a95 100644 --- a/api/src/com/todoroo/andlib/data/DatabaseDao.java +++ b/api/src/com/todoroo/andlib/data/DatabaseDao.java @@ -83,8 +83,9 @@ public class DatabaseDao { } protected void onModelUpdated(TYPE model) { + TYPE modelCopy = (TYPE) model.clone(); for(ModelUpdateListener listener : listeners) { - listener.onModelUpdated(model); + listener.onModelUpdated(modelCopy); } } diff --git a/astrid/plugin-src/com/todoroo/astrid/alarms/AlarmControlSet.java b/astrid/plugin-src/com/todoroo/astrid/alarms/AlarmControlSet.java index f1a8d9fcd..448d202d7 100644 --- a/astrid/plugin-src/com/todoroo/astrid/alarms/AlarmControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/alarms/AlarmControlSet.java @@ -6,17 +6,19 @@ import java.util.LinkedHashSet; import android.app.Activity; import android.view.LayoutInflater; import android.view.View; -import android.widget.Button; +import android.view.View.OnClickListener; import android.widget.ImageButton; import android.widget.LinearLayout; +import android.widget.TextView; import com.timsu.astrid.R; import com.todoroo.andlib.data.TodorooCursor; import com.todoroo.andlib.utility.DateUtilities; -import com.todoroo.andlib.widget.DateControlSet; import com.todoroo.astrid.data.Metadata; import com.todoroo.astrid.data.Task; import com.todoroo.astrid.helper.TaskEditControlSet; +import com.todoroo.astrid.ui.DateAndTimeDialog; +import com.todoroo.astrid.ui.DateAndTimeDialog.DateAndTimeDialogListener; /** * Control set to manage adding and removing tags @@ -30,6 +32,7 @@ public final class AlarmControlSet extends TaskEditControlSet { private final LinearLayout alertsContainer; private final Activity activity; + private final DateAndTimeDialog pickerDialog; public AlarmControlSet(Activity activity, int layout) { //View v = LayoutInflater.from(activity).inflate(R.layout.alarm_control, parent, true); @@ -42,6 +45,8 @@ public final class AlarmControlSet extends TaskEditControlSet { addAlarm(new Date()); } }); + + pickerDialog = new DateAndTimeDialog(activity, 0); } @Override @@ -60,12 +65,10 @@ public final class AlarmControlSet extends TaskEditControlSet { public String writeToModel(Task task) { LinkedHashSet alarms = new LinkedHashSet(); for(int i = 0; i < alertsContainer.getChildCount(); i++) { - DateControlSet set = (DateControlSet) alertsContainer.getChildAt(i).getTag(); - if(set == null) + Long dateValue = (Long) alertsContainer.getChildAt(i).getTag(); + if(dateValue == null) continue; - Date date = set.getDate(); - if(date != null) - alarms.add(set.getDate().getTime()); + alarms.add(dateValue); } if(AlarmService.getInstance().synchronizeAlarms(task.getId(), alarms)) @@ -78,10 +81,39 @@ public final class AlarmControlSet extends TaskEditControlSet { final View alertItem = LayoutInflater.from(activity).inflate(R.layout.alarm_edit_row, null); alertsContainer.addView(alertItem); - DateControlSet dcs = new DateControlSet(activity, (Button)alertItem.findViewById(R.id.date), - (Button)alertItem.findViewById(R.id.time)); - dcs.setDate(alert); - alertItem.setTag(dcs); + alertItem.setOnClickListener(new OnClickListener() { + @Override + public void onClick(final View v) { + pickerDialog.setSelectedDateAndTime((Long) alertItem.getTag()); + pickerDialog.setDateAndTimeDialogListener(new DateAndTimeDialogListener() { + @Override + public void onDateAndTimeSelected(long date) { + if (date > 0) { + if (!pickerDialog.hasTime()) { + Date d = new Date(date); + d.setHours(18); + d.setMinutes(0); + d.setSeconds(0); + date = d.getTime(); + } + v.setTag(date); + TextView label = (TextView) v.findViewById(R.id.alarm_string); + label.setText(pickerDialog.getDisplayString(activity, date)); + } + } + + @Override + public void onDateAndTimeCancelled() { + // Do nothing + } + }); + pickerDialog.show(); + } + }); + + alertItem.setTag(alert.getTime()); + TextView display = (TextView) alertItem.findViewById(R.id.alarm_string); + display.setText(pickerDialog.getDisplayString(activity, alert.getTime())); ImageButton reminderRemoveButton; reminderRemoveButton = (ImageButton)alertItem.findViewById(R.id.button1); diff --git a/astrid/res/color/task_edit_toggle_button_text.xml b/astrid/res/color/task_edit_toggle_button_text.xml new file mode 100644 index 000000000..b0b7280af --- /dev/null +++ b/astrid/res/color/task_edit_toggle_button_text.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/date_shortcut_bottom.xml b/astrid/res/drawable/date_shortcut_bottom.xml new file mode 100644 index 000000000..aba6749ee --- /dev/null +++ b/astrid/res/drawable/date_shortcut_bottom.xml @@ -0,0 +1,26 @@ + + + + + + + + + diff --git a/astrid/res/drawable/date_shortcut_bottom_off.xml b/astrid/res/drawable/date_shortcut_bottom_off.xml new file mode 100644 index 000000000..bb7c79961 --- /dev/null +++ b/astrid/res/drawable/date_shortcut_bottom_off.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/date_shortcut_bottom_on.xml b/astrid/res/drawable/date_shortcut_bottom_on.xml new file mode 100644 index 000000000..1c96f52de --- /dev/null +++ b/astrid/res/drawable/date_shortcut_bottom_on.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/date_shortcut_middle.xml b/astrid/res/drawable/date_shortcut_middle.xml new file mode 100644 index 000000000..33c5f98ba --- /dev/null +++ b/astrid/res/drawable/date_shortcut_middle.xml @@ -0,0 +1,26 @@ + + + + + + + + + diff --git a/astrid/res/drawable/date_shortcut_middle_off.xml b/astrid/res/drawable/date_shortcut_middle_off.xml new file mode 100644 index 000000000..8a8c5d485 --- /dev/null +++ b/astrid/res/drawable/date_shortcut_middle_off.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/astrid/res/drawable/date_shortcut_middle_on.xml b/astrid/res/drawable/date_shortcut_middle_on.xml new file mode 100644 index 000000000..65556cfc9 --- /dev/null +++ b/astrid/res/drawable/date_shortcut_middle_on.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/date_shortcut_standalone.xml b/astrid/res/drawable/date_shortcut_standalone.xml new file mode 100644 index 000000000..412447409 --- /dev/null +++ b/astrid/res/drawable/date_shortcut_standalone.xml @@ -0,0 +1,26 @@ + + + + + + + + + diff --git a/astrid/res/drawable/date_shortcut_standalone_off.xml b/astrid/res/drawable/date_shortcut_standalone_off.xml new file mode 100644 index 000000000..6e0794a2f --- /dev/null +++ b/astrid/res/drawable/date_shortcut_standalone_off.xml @@ -0,0 +1,12 @@ + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/date_shortcut_standalone_on.xml b/astrid/res/drawable/date_shortcut_standalone_on.xml new file mode 100644 index 000000000..9c264a623 --- /dev/null +++ b/astrid/res/drawable/date_shortcut_standalone_on.xml @@ -0,0 +1,14 @@ + + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/date_shortcut_top.xml b/astrid/res/drawable/date_shortcut_top.xml new file mode 100644 index 000000000..e0b4cb721 --- /dev/null +++ b/astrid/res/drawable/date_shortcut_top.xml @@ -0,0 +1,26 @@ + + + + + + + + + diff --git a/astrid/res/drawable/date_shortcut_top_off.xml b/astrid/res/drawable/date_shortcut_top_off.xml new file mode 100644 index 000000000..c07951b08 --- /dev/null +++ b/astrid/res/drawable/date_shortcut_top_off.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/date_shortcut_top_on.xml b/astrid/res/drawable/date_shortcut_top_on.xml new file mode 100644 index 000000000..605440c02 --- /dev/null +++ b/astrid/res/drawable/date_shortcut_top_on.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/deadline_timepicker_button_bl.xml b/astrid/res/drawable/deadline_timepicker_button_bl.xml new file mode 100644 index 000000000..d477daf4b --- /dev/null +++ b/astrid/res/drawable/deadline_timepicker_button_bl.xml @@ -0,0 +1,24 @@ + + + + + + + + + diff --git a/astrid/res/drawable/deadline_timepicker_button_bl_off.xml b/astrid/res/drawable/deadline_timepicker_button_bl_off.xml new file mode 100644 index 000000000..b742333c3 --- /dev/null +++ b/astrid/res/drawable/deadline_timepicker_button_bl_off.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/deadline_timepicker_button_bl_on.xml b/astrid/res/drawable/deadline_timepicker_button_bl_on.xml new file mode 100644 index 000000000..9f8a08644 --- /dev/null +++ b/astrid/res/drawable/deadline_timepicker_button_bl_on.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/deadline_timepicker_button_br.xml b/astrid/res/drawable/deadline_timepicker_button_br.xml new file mode 100644 index 000000000..3d7b3ec91 --- /dev/null +++ b/astrid/res/drawable/deadline_timepicker_button_br.xml @@ -0,0 +1,24 @@ + + + + + + + + + diff --git a/astrid/res/drawable/deadline_timepicker_button_br_off.xml b/astrid/res/drawable/deadline_timepicker_button_br_off.xml new file mode 100644 index 000000000..7936a0e2c --- /dev/null +++ b/astrid/res/drawable/deadline_timepicker_button_br_off.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/deadline_timepicker_button_br_on.xml b/astrid/res/drawable/deadline_timepicker_button_br_on.xml new file mode 100644 index 000000000..81bbc26f7 --- /dev/null +++ b/astrid/res/drawable/deadline_timepicker_button_br_on.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/deadline_timepicker_button_tl.xml b/astrid/res/drawable/deadline_timepicker_button_tl.xml new file mode 100644 index 000000000..47390f5ae --- /dev/null +++ b/astrid/res/drawable/deadline_timepicker_button_tl.xml @@ -0,0 +1,24 @@ + + + + + + + + + diff --git a/astrid/res/drawable/deadline_timepicker_button_tl_off.xml b/astrid/res/drawable/deadline_timepicker_button_tl_off.xml new file mode 100644 index 000000000..c99cd5a77 --- /dev/null +++ b/astrid/res/drawable/deadline_timepicker_button_tl_off.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/deadline_timepicker_button_tl_on.xml b/astrid/res/drawable/deadline_timepicker_button_tl_on.xml new file mode 100644 index 000000000..264876304 --- /dev/null +++ b/astrid/res/drawable/deadline_timepicker_button_tl_on.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/deadline_timepicker_button_tr.xml b/astrid/res/drawable/deadline_timepicker_button_tr.xml new file mode 100644 index 000000000..4e1df4b2f --- /dev/null +++ b/astrid/res/drawable/deadline_timepicker_button_tr.xml @@ -0,0 +1,24 @@ + + + + + + + + + diff --git a/astrid/res/drawable/deadline_timepicker_button_tr_off.xml b/astrid/res/drawable/deadline_timepicker_button_tr_off.xml new file mode 100644 index 000000000..bf230d1d3 --- /dev/null +++ b/astrid/res/drawable/deadline_timepicker_button_tr_off.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/deadline_timepicker_button_tr_on.xml b/astrid/res/drawable/deadline_timepicker_button_tr_on.xml new file mode 100644 index 000000000..7fb8fe038 --- /dev/null +++ b/astrid/res/drawable/deadline_timepicker_button_tr_on.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/icn_arrow_down.png b/astrid/res/drawable/icn_arrow_down.png new file mode 100644 index 000000000..3ffbaac88 Binary files /dev/null and b/astrid/res/drawable/icn_arrow_down.png differ diff --git a/astrid/res/drawable/icn_arrow_left.png b/astrid/res/drawable/icn_arrow_left.png new file mode 100644 index 000000000..a573595af Binary files /dev/null and b/astrid/res/drawable/icn_arrow_left.png differ diff --git a/astrid/res/drawable/icn_arrow.png b/astrid/res/drawable/icn_arrow_right.png similarity index 100% rename from astrid/res/drawable/icn_arrow.png rename to astrid/res/drawable/icn_arrow_right.png diff --git a/astrid/res/drawable/icn_arrow_up.png b/astrid/res/drawable/icn_arrow_up.png new file mode 100644 index 000000000..56ae0016a Binary files /dev/null and b/astrid/res/drawable/icn_arrow_up.png differ diff --git a/astrid/res/drawable/members_arrow_white.xml b/astrid/res/drawable/members_arrow_white.xml index 254a95923..7be341d28 100644 --- a/astrid/res/drawable/members_arrow_white.xml +++ b/astrid/res/drawable/members_arrow_white.xml @@ -17,7 +17,7 @@ + android:state_focused="false" android:drawable="@drawable/icn_arrow_right" /> + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/timepicker_am_btn.xml b/astrid/res/drawable/timepicker_am_btn.xml new file mode 100644 index 000000000..8caf019f1 --- /dev/null +++ b/astrid/res/drawable/timepicker_am_btn.xml @@ -0,0 +1,24 @@ + + + + + + + + + diff --git a/astrid/res/drawable/timepicker_am_btn_off.xml b/astrid/res/drawable/timepicker_am_btn_off.xml new file mode 100644 index 000000000..ec0fb1656 --- /dev/null +++ b/astrid/res/drawable/timepicker_am_btn_off.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/timepicker_am_btn_on.xml b/astrid/res/drawable/timepicker_am_btn_on.xml new file mode 100644 index 000000000..a995c53bf --- /dev/null +++ b/astrid/res/drawable/timepicker_am_btn_on.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/timepicker_pm_btn.xml b/astrid/res/drawable/timepicker_pm_btn.xml new file mode 100644 index 000000000..b49dbdee3 --- /dev/null +++ b/astrid/res/drawable/timepicker_pm_btn.xml @@ -0,0 +1,24 @@ + + + + + + + + + diff --git a/astrid/res/drawable/timepicker_pm_btn_off.xml b/astrid/res/drawable/timepicker_pm_btn_off.xml new file mode 100644 index 000000000..5eb343d93 --- /dev/null +++ b/astrid/res/drawable/timepicker_pm_btn_off.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/timepicker_pm_btn_on.xml b/astrid/res/drawable/timepicker_pm_btn_on.xml new file mode 100644 index 000000000..281a42b9e --- /dev/null +++ b/astrid/res/drawable/timepicker_pm_btn_on.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/astrid/res/layout-land/date_time_picker.xml b/astrid/res/layout-land/date_time_picker.xml new file mode 100644 index 000000000..0645a0023 --- /dev/null +++ b/astrid/res/layout-land/date_time_picker.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/astrid/res/layout/alarm_edit_row.xml b/astrid/res/layout/alarm_edit_row.xml index 7b51c4911..44f5fe563 100644 --- a/astrid/res/layout/alarm_edit_row.xml +++ b/astrid/res/layout/alarm_edit_row.xml @@ -15,25 +15,38 @@ --> - -