Trip.Builder


class Trip.Builder


A builder of Trip.

Summary

Public constructors

Constructs an empty Builder instance.

Public functions

Trip.Builder
addDestination(
    destination: Destination,
    destinationTravelEstimate: TravelEstimate
)

Adds a destination to the trip.

Trip.Builder
addStep(step: Step, stepTravelEstimate: TravelEstimate)

Adds a step to the trip.

Trip

Constructs the Trip defined by this builder.

Trip.Builder

Sets a description of the current road.

Trip.Builder
setLoading(isLoading: Boolean)

Sets whether the Trip is in a loading state.

Public constructors

Builder

Added in 1.0.0
Builder()

Constructs an empty Builder instance.

Public functions

addDestination

Added in 1.0.0
fun addDestination(
    destination: Destination,
    destinationTravelEstimate: TravelEstimate
): Trip.Builder

Adds a destination to the trip.

Destinations must be added in order of arrival. A destination is not required. Display surfaces may or may not use the destination and if multiple destinations are added the display may only show information about the first destination.

For every destination added, a corresponding TravelEstimate must be provided. Display surfaces may or may not use the destination travel estimate and if multiple destination travel estimates are added the display may only show information about the first destination travel estimate.

Throws
java.lang.NullPointerException

if step or stepTravelEstimate are null

addStep

Added in 1.0.0
fun addStep(step: Step, stepTravelEstimate: TravelEstimate): Trip.Builder

Adds a step to the trip.

Steps must be added in order of arrival. A step is not required. Display surfaces may or may not use the step and if multiple steps are added the display may only show information about the first step.

For every step added, a corresponding TravelEstimate must be provided. Display surfaces may or may not use the step travel estimate and if multiple step travel estimates are added the display may only show information about the first step travel estimate.

Throws
java.lang.NullPointerException

if step or stepTravelEstimate are null

build

Added in 1.0.0
fun build(): Trip

Constructs the Trip defined by this builder.

setCurrentRoad

Added in 1.0.0
fun setCurrentRoad(currentRoad: CharSequence): Trip.Builder

Sets a description of the current road.

Spans are not supported in the input string and will be ignored.

Throws
java.lang.NullPointerException

if currentRoad is null

See also
CarText

setLoading

Added in 1.0.0
fun setLoading(isLoading: Boolean): Trip.Builder

Sets whether the Trip is in a loading state.

If set to true, the UI may show a loading indicator, and adding any steps or step travel estimates will throw an IllegalArgumentException.