Search in sources :

Example 1 with GetAllTasksRequest

use of com.cmput301w18t05.taskzilla.request.command.GetAllTasksRequest in project Taskzilla by CMPUT301W18T05.

the class SearchController method getAllRequest.

/**
 * This method invokes a get all request, which is then sent
 * to the request manager which determines if the app is online or offline,
 * before doing the request.
 *
 * @see             RequestManager
 */
public void getAllRequest() {
    GetAllTasksRequest request = new GetAllTasksRequest();
    RequestManager.getInstance().invokeRequest(ctx, request);
    searchResults.clear();
    ArrayList<Task> temp;
    temp = request.getResult();
    System.out.println("Search result is: " + temp);
    while (temp != null && temp.size() > 0) {
        for (Task t : temp) {
            if (!t.getStatus().equalsIgnoreCase("assigned") && !t.getStatus().equalsIgnoreCase("completed")) {
                this.searchResults.add(t);
            }
        }
        RequestManager.getInstance().invokeRequest(ctx, request);
        temp = request.getResult();
    }
    view.notifyChange();
}
Also used : Task(com.cmput301w18t05.taskzilla.Task) GetAllTasksRequest(com.cmput301w18t05.taskzilla.request.command.GetAllTasksRequest)

Example 2 with GetAllTasksRequest

use of com.cmput301w18t05.taskzilla.request.command.GetAllTasksRequest in project Taskzilla by CMPUT301W18T05.

the class MapActivity method onCreate.

/**
 * Activity uses the activity_map.xml layout
 * Initializes a map fragment
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_map);
    // Obtain the SupportMapFragment and get notified when the map is ready to be used.
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.dragdropMap);
    mapFragment.getMapAsync(this);
    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    getAllTasksRequest = new GetAllTasksRequest();
    RequestManager.getInstance().invokeRequest(getApplicationContext(), getAllTasksRequest);
    tasks = new ArrayList<>();
    while (getAllTasksRequest.getResult().size() > 0) {
        tasks.addAll(getAllTasksRequest.getResult());
        RequestManager.getInstance().invokeRequest(getApplicationContext(), getAllTasksRequest);
    }
}
Also used : SupportMapFragment(com.google.android.gms.maps.SupportMapFragment) GetAllTasksRequest(com.cmput301w18t05.taskzilla.request.command.GetAllTasksRequest)

Aggregations

GetAllTasksRequest (com.cmput301w18t05.taskzilla.request.command.GetAllTasksRequest)2 Task (com.cmput301w18t05.taskzilla.Task)1 SupportMapFragment (com.google.android.gms.maps.SupportMapFragment)1