/** * Called by the RefreshReceiver when the task list receives a refresh broadcast. Subclasses * should override this. */ protected void refresh() { if (taskAdapter != null) { taskAdapter.flushCaches(); } taskDeleter.deleteTasksWithEmptyTitles(); loadTaskListContent(); }
@Override public boolean onOptionsItemSelected(final MenuItem item) { long itemId; if (!isCurrentTaskListFragment()) { return false; } switch (item.getItemId()) { // --- context menu items case CONTEXT_MENU_EDIT_TASK_ID: itemId = item.getGroupId(); mListener.onTaskListItemClicked(itemId); return true; case CONTEXT_MENU_COPY_TASK_ID: itemId = item.getGroupId(); duplicateTask(itemId); return true; case CONTEXT_MENU_DELETE_TASK_ID: { itemId = item.getGroupId(); Task task = taskService.fetchById(itemId, Task.ID, Task.UUID); if (task != null) { deleteTask(task); } return true; } case CONTEXT_MENU_UNDELETE_TASK_ID: { itemId = item.getGroupId(); Task task = new Task(); task.setId(itemId); task.setDeletionDate(0L); taskService.save(task); loadTaskListContent(); return true; } case CONTEXT_MENU_PURGE_TASK_ID: { itemId = item.getGroupId(); Task task = new Task(); task.setId(itemId); TimerPlugin.updateTimer(notificationManager, taskService, getActivity(), task, false); taskDeleter.purge(itemId); loadTaskListContent(); return true; } default: return super.onOptionsItemSelected(item); } }