use of ve.com.abicelis.remindy.model.TasksByDoneDateComparator in project Remindy by abicelis.
the class TaskSortingUtil method generateDoneTaskHeaderList.
/* Done Tasks */
public ArrayList<TaskViewModel> generateDoneTaskHeaderList(List<Task> tasks, TaskSortType sortType, Resources resources) throws InvalidClassException {
ArrayList<TaskViewModel> result = new ArrayList<>();
clearTaskBuckets();
if (sortType == TaskSortType.DATE) {
//Sorting by doneDate!
Collections.sort(tasks, new TasksByDoneDateComparator());
for (Task current : tasks) {
if (current.getReminderType() == null)
throw new NullPointerException("NULL ReminderType passed into TaskSortingUtil.generateProgrammedTaskHeaderList()");
insertDoneTaskIntoBucket(current, current.getDoneDate());
}
if (tasksToday.size() > 0) {
result.add(new TaskViewModel(resources.getString(R.string.task_header_today), false));
dumpTaskBucketIntoViewModelList(tasksToday, result);
}
if (tasksYesterday.size() > 0) {
result.add(new TaskViewModel(resources.getString(R.string.task_header_yesterday), false));
dumpTaskBucketIntoViewModelList(tasksYesterday, result);
}
if (tasksThisWeek.size() > 0) {
result.add(new TaskViewModel(resources.getString(R.string.task_header_this_week), false));
dumpTaskBucketIntoViewModelList(tasksThisWeek, result);
}
if (tasksLastWeek.size() > 0) {
result.add(new TaskViewModel(resources.getString(R.string.task_header_last_week), false));
dumpTaskBucketIntoViewModelList(tasksLastWeek, result);
}
if (tasksThisMonth.size() > 0) {
result.add(new TaskViewModel(resources.getString(R.string.task_header_this_month), false));
dumpTaskBucketIntoViewModelList(tasksThisMonth, result);
}
if (tasksLastMonth.size() > 0) {
result.add(new TaskViewModel(resources.getString(R.string.task_header_last_month), false));
dumpTaskBucketIntoViewModelList(tasksLastMonth, result);
}
if (tasksThisYear.size() > 0) {
result.add(new TaskViewModel(resources.getString(R.string.task_header_this_year), false));
dumpTaskBucketIntoViewModelList(tasksThisYear, result);
}
if (tasksLastYear.size() > 0) {
result.add(new TaskViewModel(resources.getString(R.string.task_header_last_year), false));
dumpTaskBucketIntoViewModelList(tasksLastYear, result);
}
if (tasksPast.size() > 0) {
result.add(new TaskViewModel(resources.getString(R.string.task_header_past), false));
dumpTaskBucketIntoViewModelList(tasksPast, result);
}
} else if (sortType == TaskSortType.PLACE) {
handleSortingByPlace(tasks, result, resources);
}
return result;
}
Aggregations