use of com.cmput301w18t05.taskzilla.request.command.GetTaskRequest in project Taskzilla by CMPUT301W18T05.
the class TasksRequesterFragment method viewTask.
/**
* upon pressing a task on the listview, switches to ViewTaskActivity
* @param id id of the task to be view is passed in as a String
* @author Colin
*/
public void viewTask(String id) {
/*
try except statement, when task clicked. Attempts to get from elastic search in order to test
if the task still exists or not.
*/
try {
GetTaskRequest request = new GetTaskRequest(id);
RequestManager.getInstance().invokeRequest(getContext(), request);
Task testTask = request.getResult();
String testTaskId = testTask.getTaskRequester().getId();
Intent intent = new Intent(getActivity(), ViewTaskActivity.class);
intent.putExtra("TaskId", id);
startActivity(intent);
} catch (Exception e) {
RequestManager.getInstance().invokeRequest(getContext(), requestTasks);
taskList.clear();
taskList.addAll(requestTasks.getResult());
adapter.notifyDataSetChanged();
Toast.makeText(getActivity(), "Task no longer exists", Toast.LENGTH_SHORT).show();
}
}
Aggregations