コード例 #1
0
  public static void rescheduleTask(Task task, long newDueDate) {
    long hideUntil = task.getValue(Task.HIDE_UNTIL);
    if (hideUntil > 0 && task.getValue(Task.DUE_DATE) > 0) {
      hideUntil += newDueDate - task.getValue(Task.DUE_DATE);
    }

    task.setValue(Task.COMPLETION_DATE, 0L);
    task.setValue(Task.DUE_DATE, newDueDate);
    task.setValue(Task.HIDE_UNTIL, hideUntil);
    task.putTransitory(TaskService.TRANS_REPEAT_COMPLETE, true);

    ContentResolver cr = ContextManager.getContext().getContentResolver();
    GCalHelper.rescheduleRepeatingTask(task, cr);
    PluginServices.getTaskService().save(task);
  }
コード例 #2
0
  public static void rescheduleTask(
      Context context, GCalHelper gcalHelper, TaskService taskService, Task task, long newDueDate) {
    long hideUntil = task.getHideUntil();
    if (hideUntil > 0 && task.getDueDate() > 0) {
      hideUntil += newDueDate - task.getDueDate();
    }

    task.setReminderSnooze(0L);
    task.setCompletionDate(0L);
    task.setDueDate(newDueDate);
    task.setHideUntil(hideUntil);
    task.putTransitory(TaskService.TRANS_REPEAT_COMPLETE, true);

    ContentResolver cr = context.getContentResolver();
    gcalHelper.rescheduleRepeatingTask(task, cr);
    taskService.save(task);
  }