Track multiple tasks

In the previous guide, we integrated the Map Fragment in your app's View and specified all the methods which can be used to customize the UI. The Map Fragment allows for multiple tasks for single destination to be tracked on the same map view. This guide will cover the multiple tasks tracking scenario.

In case there are multiple tasks that needs to be tracked on the same map view, this can be achieved by specifying multiple taskIDs in taskIDsToTrack method of HTMapAdapter class.

[warning] Single Destination for Multiple Task Tracking

To be able to track multiple tasks on the map view, All the tasks should have the same destination. Otherwise, the map view will assume them to belong to the destination as that of the first task.

Multiple tasks

Customizing destination marker

In case Destination marker needs to be displayed in Multiple Tasks View, call showMultipleTasksDestinationMarker method of HTMapAdapter class.

@Override
public boolean showMultipleTasksDestinationMarker(HTMapFragment mapFragment) {
  return true;
}

You can customise the multiple tasks view destination marker image by adding a drawable resource in your application with the name ic_ht_destination_marker_default.png as is in our SDK.

This can also be done by overriding HTMapAdapter methods. Override getMultipleTasksDestinationMarkerIcon method to set a drawable resource as hero marker image or getMultipleTasksDestinationMarkerView method to set a view as hero marker image.

[warning] Override

getMultipleTasksDestinationMarkerIcon method's implementation will override the one specified in getMultipleTasksDestinationMarkerView.

@Override
public int getMultipleTasksDestinationMarkerIcon(HTMapFragment mapFragment) {
  return R.drawable.ic_ht_destination_marker;
}

Additionally, if you can also specify Multiple Tasks View Destination Marker Anchor Values by overriding getMultipleTasksDestinationMarkerAnchorValues method of HTMapAdapter class.

@Override
public float[] getMultipleTasksDestinationMarkerAnchorValues(HTMapFragment mapFragment, String taskID) {
  return new float[]{0.5f, 0.915f};
}

Customizing info views

In order to hide the Destination Address Layout in the Multiple Tasks View, override the showAddressInfoViewForMultipleTasksView method of HTMapAdapter class. Similarly override the showDriverInfoForMultipleTasksView method to hide the Driver Info Layout.

@Override
public boolean showAddressInfoViewForMultipleTasksView(HTMapFragment mapFragment, String taskID) {
  return false;
}

@Override
public boolean showDriverInfoForMultipleTasksView(HTMapFragment mapFragment, String taskID) {
  return false;
}

Customizing toolbar title

In order to set the Toolbar Title in the Multiple Tasks View, override the getMultipleTasksOrderStatusToolbarTitle method of HTMapAdapter class.

@Override
public String getMultipleTasksOrderStatusToolbarTitle(HTMapFragment mapFragment, String taskID) {
  return "My Toolbar Title";
}

results matching ""

    No results matching ""