Builder

class Builder
kotlin.Any
   ↳ androidx.car.cluster.navigation.NavigationState.Builder

Builder for creating a NavigationState

Summary

Public constructors

Builder for creating a NavigationState

Public methods

NavigationState.Builder
addDestination(@NonNull destination: Destination)

Add a destination or intermediate stop in the navigation.

NavigationState.Builder
addStep(@NonNull step: Step)

Add a navigation step.

NavigationState

Returns a NavigationState built with the provided information.

NavigationState.Builder
setCurrentSegment(@Nullable segment: Segment?)

Sets the current segment being driven, or null if the segment being driven is unknown.

NavigationState.Builder
setServiceStatus(@NonNull serviceStatus: NavigationState.ServiceStatus, @NonNull vararg fallbackServiceStatuses: NavigationState.ServiceStatus!)

Sets the service status (e.g.: normal operation, re-routing in progress, etc.)

Public constructors

<init>

Builder()

Builder for creating a NavigationState

Public methods

addDestination

@NonNull fun addDestination(@NonNull destination: Destination): NavigationState.Builder

Add a destination or intermediate stop in the navigation. Destinations should be provided from nearest to furthest.

Return
NavigationState.Builder: this object for chaining

addStep

@NonNull fun addStep(@NonNull step: Step): NavigationState.Builder

Add a navigation step. Steps should be provided in order of execution. It is up to the producer to decide how many steps in advance will be provided.

Return
NavigationState.Builder: this object for chaining

build

@NonNull fun build(): NavigationState

Returns a NavigationState built with the provided information.

setCurrentSegment

@NonNull fun setCurrentSegment(@Nullable segment: Segment?): NavigationState.Builder

Sets the current segment being driven, or null if the segment being driven is unknown.

setServiceStatus

@NonNull fun setServiceStatus(@NonNull serviceStatus: NavigationState.ServiceStatus, @NonNull vararg fallbackServiceStatuses: NavigationState.ServiceStatus!): NavigationState.Builder

Sets the service status (e.g.: normal operation, re-routing in progress, etc.)

Parameters
serviceStatus NavigationState.ServiceStatus: current service status
fallbackServiceStatuses NavigationState.ServiceStatus: variations of the current service status (ordered from specific to generic), in case the main one is not understood by the consumer of this API. In such scenario, consumers will receive the first value in this list that they can deserialize.
Return
NavigationState.Builder: this object for chaining