Now, repeated completed tasks will be recorded as such on the website

pull/14/head
Tim Su 14 years ago
parent d4cfb9a072
commit 7b6ac917a9

@ -300,7 +300,9 @@ public final class ActFmSyncService {
if(values.containsKey(Task.DELETION_DATE.name)) {
params.add("deleted_at"); params.add(task.getValue(Task.DELETION_DATE) / 1000L);
}
if(values.containsKey(Task.COMPLETION_DATE.name)) {
if(Flags.checkAndClear(Flags.ACTFM_REPEATED_TASK)) {
params.add("completed"); params.add(DateUtilities.now() / 1000L);
} else if(values.containsKey(Task.COMPLETION_DATE.name)) {
params.add("completed"); params.add(task.getValue(Task.COMPLETION_DATE) / 1000L);
}
if(values.containsKey(Task.IMPORTANCE.name)) {

@ -75,6 +75,7 @@ public class RepeatTaskCompleteListener extends BroadcastReceiver {
task.setValue(Task.COMPLETION_DATE, 0L);
task.setValue(Task.DUE_DATE, newDueDate);
task.setValue(Task.HIDE_UNTIL, hideUntil);
Flags.set(Flags.ACTFM_REPEATED_TASK);
PluginServices.getTaskService().save(task);
return;
}
@ -119,17 +120,17 @@ public class RepeatTaskCompleteListener extends BroadcastReceiver {
// initialize startDateAsDV
Date original = setUpStartDate(task, repeatAfterCompletion, rrule.getFreq());
DateValue startDateAsDV = setUpStartDateAsDV(task, rrule, original, repeatAfterCompletion);
DateValue startDateAsDV = setUpStartDateAsDV(task, original);
if(rrule.getFreq() == Frequency.HOURLY || rrule.getFreq() == Frequency.MINUTELY)
return handleSubdayRepeat(original, rrule);
else if(rrule.getByDay().size() > 0 && repeatAfterCompletion)
return handleWeeklyRepeatAfterComplete(rrule, original, startDateAsDV);
return handleWeeklyRepeatAfterComplete(rrule, original);
else
return invokeRecurrence(rrule, original, startDateAsDV);
}
private static long handleWeeklyRepeatAfterComplete(RRule rrule, Date original, DateValue startDateAsDV) {
private static long handleWeeklyRepeatAfterComplete(RRule rrule, Date original) {
List<WeekdayNum> byDay = rrule.getByDay();
long newDate = original.getTime();
newDate += DateUtilities.ONE_WEEK * (rrule.getInterval() - 1);
@ -242,8 +243,7 @@ public class RepeatTaskCompleteListener extends BroadcastReceiver {
return startDate;
}
private static DateValue setUpStartDateAsDV(Task task, RRule rrule, Date startDate,
boolean repeatAfterCompletion) {
private static DateValue setUpStartDateAsDV(Task task, Date startDate) {
if(task.hasDueTime())
return new DateTimeValueImpl(startDate.getYear() + 1900,
startDate.getMonth() + 1, startDate.getDate(),

@ -34,9 +34,13 @@ public class Flags {
/**
* If set, indicates to suppress the next gtasks sync attempt
*/
public static final int GTASKS_SUPPRESS_SYNC = 1 << 5;
/**
* If set, indicates next task was a completed repeating task
*/
public static final int ACTFM_REPEATED_TASK = 1 << 6;
public static boolean checkAndClear(int flag) {
boolean set = (state & flag) > 0;
state &= ~flag;

Loading…
Cancel
Save