Trip.Builder
public
static
class
Trip.Builder
extends Object
java.lang.Object | |
↳ | com.google.android.libraries.car.app.navigation.model.Trip.Builder |
A builder of Trip
.
Summary
Public constructors | |
---|---|
Builder()
|
Public methods | |
---|---|
Trip.Builder
|
addDestination(Destination destination)
Adds a destination to the trip. |
Trip.Builder
|
addDestinationTravelEstimate(TravelEstimate destinationTravelEstimate)
Adds a destination travel estimate to the trip. |
Trip.Builder
|
addStep(Step step)
Adds a step to the trip. |
Trip.Builder
|
addStepTravelEstimate(TravelEstimate stepTravelEstimate)
Adds a step travel estimate to the trip. |
Trip
|
build()
|
Trip.Builder
|
clearDestinationTravelEstimates()
Clears the list of destination travel estimates in the builder. |
Trip.Builder
|
clearDestinations()
Clears the list of destinations in the builder. |
Trip.Builder
|
clearStepTravelEstimates()
Clears the list of destination travel estimates in the builder. |
Trip.Builder
|
clearSteps()
Clears the list of steps in the builder. |
Trip.Builder
|
setCurrentRoad(CharSequence currentRoad)
Sets a text description of the current road or |
Trip.Builder
|
setIsLoading(boolean isLoading)
Sets whether the |
Inherited methods | |
---|---|
Public constructors
Builder
public Builder ()
Public methods
addDestination
public Trip.Builder addDestination (Destination destination)
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 added via
addDestinationTravelEstimate(TravelEstimate)
.They are added separately so that travel estimates can
be updated frequently based on location.
Parameters | |
---|---|
destination |
Destination |
Returns | |
---|---|
Trip.Builder |
addDestinationTravelEstimate
public Trip.Builder addDestinationTravelEstimate (TravelEstimate destinationTravelEstimate)
Adds a destination travel estimate to the trip.
Destination travel estimates must be added in order of arrival. A destination travel estimate is not required. 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.
For every destination travel estimate added, a corresponding destination must also be added. They are added separately so that travel estimates can be updated frequently based on location.
Parameters | |
---|---|
destinationTravelEstimate |
TravelEstimate |
Returns | |
---|---|
Trip.Builder |
addStep
public Trip.Builder addStep (Step step)
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 added via addStepTravelEstimate(TravelEstimate)
. They are added separately so that travel estimates can be updated
frequently based on location.
Parameters | |
---|---|
step |
Step |
Returns | |
---|---|
Trip.Builder |
addStepTravelEstimate
public Trip.Builder addStepTravelEstimate (TravelEstimate stepTravelEstimate)
Adds a step travel estimate to the trip.
Step travel estimates must be added in order of arrival. A step travel estimate is not required. 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.
For every step travel estimate added, a corresponding step must also be added.
Parameters | |
---|---|
stepTravelEstimate |
TravelEstimate |
Returns | |
---|---|
Trip.Builder |
clearDestinationTravelEstimates
public Trip.Builder clearDestinationTravelEstimates ()
Clears the list of destination travel estimates in the builder.
Returns | |
---|---|
Trip.Builder |
clearDestinations
public Trip.Builder clearDestinations ()
Clears the list of destinations in the builder.
Returns | |
---|---|
Trip.Builder |
clearStepTravelEstimates
public Trip.Builder clearStepTravelEstimates ()
Clears the list of destination travel estimates in the builder.
Returns | |
---|---|
Trip.Builder |
clearSteps
public Trip.Builder clearSteps ()
Clears the list of steps in the builder.
Returns | |
---|---|
Trip.Builder |
setCurrentRoad
public Trip.Builder setCurrentRoad (CharSequence currentRoad)
Sets a text description of the current road or null
if unknown.
Parameters | |
---|---|
currentRoad |
CharSequence |
Returns | |
---|---|
Trip.Builder |
setIsLoading
public Trip.Builder setIsLoading (boolean isLoading)
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
.
Parameters | |
---|---|
isLoading |
boolean |
Returns | |
---|---|
Trip.Builder |