Exemplo n.º 1
0
  private final void removeTask(Task task) {

    final ArrayList<Task> list = mTaskList;
    final ArrayList<Task> temp = mTaskTempList;
    final ITaskStateListener listener = mTaskStateListener;

    if (listener != null) listener.remove(task);

    list.remove(task);
    temp.remove(task);

    notifyDataSetChanged();
  }
Exemplo n.º 2
0
  private final void updateTaskState(Task task) {

    final ITaskStateListener listener = mTaskStateListener;
    int state = task.getState();

    if (state == Task.STATE.NEW || state == Task.STATE.RUNNING || state == Task.STATE.WAIT) {

      if (listener != null) listener.change(task, state, Task.STATE.STOP);

      task.setState(Task.STATE.STOP);

    } else if (state == Task.STATE.STOP) {

      if (listener != null) listener.change(task, state, Task.STATE.WAIT);

      task.setState(Task.STATE.WAIT);
    }

    notifyDataSetChanged();
  }