Clustered tasks

Work with clustered tasks

Overview

Clusters are basically a collection of tasks that have common characteristic like
Tasks that have the same pick up location or tasks that have the same drop-off location.

Cluster logic is generally for convince of the SDK implementor and it can be used to build a more robust UI.

The cluster interface:

public interface Cluster {
    public abstract val wayPoints: Array<Waypoint>
    public abstract val isPickup: Boolean
}

Observe Cluster updates

Clustered tasks can be observed using a LiveData object obtained from DriverSdk:

val driverSdk = DriverSdkProvider.driverSdk
driverSdk.data.clusters.observe(viewLifecycleOwner) {
            Log.i(TAG, "clusters updated, clusters=$it")
            adapter.submitList(it) {
                remeasure(recyclerView)
            }
        }