Exemplo n.º 1
0
  @Override
  public void addTask(ModelTask newTask, boolean saveToDB) {
    int position = -1;
    checkAdapter();

    for (int i = 0; i < adapter.getItemCount(); i++) {
      if (adapter.getItem(i).isTask()) {
        ModelTask task = (ModelTask) adapter.getItem(i);
        if (newTask.getDate() < task.getDate()) {
          position = i;
          break;
        }
      }
    }

    if (position != -1) {
      adapter.addItem(position, newTask);
    } else {
      adapter.addItem(newTask);
    }

    if (saveToDB) {
      activity.dbHelper.saveTask(newTask);
    }
  }
Exemplo n.º 2
0
 @Override
 public void moveTask(ModelTask task) {
   if (task.getDate() != 0) {
     alarmHelper.setAlarm(task);
   }
   onTaskRestoreListener.onTaskRestore(task);
 }
Exemplo n.º 3
0
 public void task(ModelTask task) {
   title(task.getTimeStamp(), task.getTitle());
   date(task.getTimeStamp(), task.getDate());
   priority(task.getTimeStamp(), task.getPriority());
   status(task.getTimeStamp(), task.getStatus());
 }