From de29f3d7ce2f4f1cceb9be266238ff7a958b8bf8 Mon Sep 17 00:00:00 2001 From: Arne Jans Date: Mon, 9 May 2011 13:01:20 +0200 Subject: [PATCH] fixed (Repeating From Completion Date --> Loss of Due Time) --- .../repeats/RepeatTaskCompleteListener.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/repeats/RepeatTaskCompleteListener.java b/astrid/plugin-src/com/todoroo/astrid/repeats/RepeatTaskCompleteListener.java index 60c624dff..82732c816 100644 --- a/astrid/plugin-src/com/todoroo/astrid/repeats/RepeatTaskCompleteListener.java +++ b/astrid/plugin-src/com/todoroo/astrid/repeats/RepeatTaskCompleteListener.java @@ -82,15 +82,24 @@ public class RepeatTaskCompleteListener extends BroadcastReceiver { DateValue today = new DateValueImpl(repeatFromDate.getYear() + 1900, repeatFromDate.getMonth() + 1, repeatFromDate.getDate()); - if(task.hasDueDate() && !task.getFlag(Task.FLAGS, Task.FLAG_REPEAT_AFTER_COMPLETION)) { + boolean repeatAfterCompletion = task.getFlag(Task.FLAGS, Task.FLAG_REPEAT_AFTER_COMPLETION); + if(task.hasDueDate() && !repeatAfterCompletion) { repeatFromDate = new Date(task.getValue(Task.DUE_DATE)); if(task.hasDueTime()) { repeatFrom = new DateTimeValueImpl(repeatFromDate.getYear() + 1900, repeatFromDate.getMonth() + 1, repeatFromDate.getDate(), repeatFromDate.getHours(), repeatFromDate.getMinutes(), repeatFromDate.getSeconds()); } else { - repeatFrom = new DateValueImpl(repeatFromDate.getYear() + 1900, - repeatFromDate.getMonth() + 1, repeatFromDate.getDate()); + repeatFrom = today; + } + } else if (task.hasDueDate() && repeatAfterCompletion) { + repeatFromDate = new Date(task.getValue(Task.DUE_DATE)); + if(task.hasDueTime()) { + repeatFrom = new DateTimeValueImpl(today.year(), + today.month(), today.day(), + repeatFromDate.getHours(), repeatFromDate.getMinutes(), repeatFromDate.getSeconds()); + } else { + repeatFrom = today; } } else { repeatFrom = today; @@ -141,7 +150,7 @@ public class RepeatTaskCompleteListener extends BroadcastReceiver { nextDate.day()).getTime()); } - if(newDueDate > DateUtilities.now() && newDueDate != repeatFromDate.getTime()) + if(newDueDate > DateUtilities.now() && (repeatAfterCompletion || (newDueDate != repeatFromDate.getTime()))) break; }