TravelEstimate.Builder

class TravelEstimate.Builder


A builder of TravelEstimate.

Summary

Public constructors

Builder(
    remainingDistance: Distance,
    arrivalTimeAtDestination: DateTimeWithZone
)

Constructs a new builder of TravelEstimate.

@RequiresApi(value = 26)
Builder(
    remainingDistance: Distance,
    arrivalTimeAtDestination: ZonedDateTime
)

Constructs a new builder of TravelEstimate.

Public functions

TravelEstimate

Constructs the TravelEstimate defined by this builder.

TravelEstimate.Builder
setRemainingDistanceColor(remainingDistanceColor: CarColor)

Sets the color of the remaining distance text.

TravelEstimate.Builder
@RequiresApi(value = 26)
setRemainingTime(remainingTime: Duration)

Sets the estimated time remaining until arriving at the destination.

TravelEstimate.Builder
setRemainingTimeColor(remainingTimeColor: CarColor)

Sets the color of the remaining time text.

TravelEstimate.Builder
setRemainingTimeSeconds(remainingTimeSeconds: @IntRange(from = "-1") Long)

Sets the estimated time remaining until arriving at the destination, in seconds.

TravelEstimate.Builder
@RequiresCarApi(value = 5)
setTripIcon(tripIcon: CarIcon)

Sets a CarIcon that is associated with the current TravelEstimate

TravelEstimate.Builder
@RequiresCarApi(value = 5)
setTripText(tripText: CarText)

Sets the trip text.

Public constructors

Builder

Added in 1.0.0
Builder(
    remainingDistance: Distance,
    arrivalTimeAtDestination: DateTimeWithZone
)

Constructs a new builder of TravelEstimate.

Parameters
remainingDistance: Distance

The estimated remaining Distance until arriving at the destination

arrivalTimeAtDestination: DateTimeWithZone

The arrival time with the time zone information provided for the destination

Throws
java.lang.NullPointerException

if remainingDistance or arrivalTimeAtDestination are null

Builder

Added in 1.0.0
@RequiresApi(value = 26)
Builder(
    remainingDistance: Distance,
    arrivalTimeAtDestination: ZonedDateTime
)

Constructs a new builder of TravelEstimate.

Parameters
remainingDistance: Distance

The estimated remaining Distance until arriving at the destination

arrivalTimeAtDestination: ZonedDateTime

The arrival time with the time zone information provided for the destination

Throws
java.lang.NullPointerException

if remainingDistance or arrivalTimeAtDestination are null

Public functions

build

Added in 1.0.0
fun build(): TravelEstimate

Constructs the TravelEstimate defined by this builder.

setRemainingDistanceColor

Added in 1.0.0
fun setRemainingDistanceColor(remainingDistanceColor: CarColor): TravelEstimate.Builder

Sets the color of the remaining distance text.

Depending on contrast requirements, capabilities of the vehicle screens, or other factors, the color may be ignored by the host or overridden by the vehicle system.

If not set, DEFAULT will be used.

Custom colors created with createCustom are not supported.

Throws
java.lang.IllegalArgumentException

if remainingDistanceColor is not supported

java.lang.NullPointerException

if remainingDistanceColor is null

setRemainingTime

Added in 1.0.0
@RequiresApi(value = 26)
fun setRemainingTime(remainingTime: Duration): TravelEstimate.Builder

Sets the estimated time remaining until arriving at the destination.

If not set, REMAINING_TIME_UNKNOWN will be used.

Throws
java.lang.IllegalArgumentException

if remainingTime is a negative duration but not REMAINING_TIME_UNKNOWN

java.lang.NullPointerException

if remainingTime is null

setRemainingTimeColor

Added in 1.0.0
fun setRemainingTimeColor(remainingTimeColor: CarColor): TravelEstimate.Builder

Sets the color of the remaining time text.

Depending on contrast requirements, capabilities of the vehicle screens, or other factors, the color may be ignored by the host or overridden by the vehicle system.

If not set, DEFAULT will be used.

Custom colors created with createCustom are not supported.

Throws
java.lang.IllegalArgumentException

if remainingTimeColor is not supported

java.lang.NullPointerException

if remainingTimecolor is null

setRemainingTimeSeconds

Added in 1.0.0
fun setRemainingTimeSeconds(remainingTimeSeconds: @IntRange(from = "-1") Long): TravelEstimate.Builder

Sets the estimated time remaining until arriving at the destination, in seconds.

If not set, REMAINING_TIME_UNKNOWN will be used.

Note that REMAINING_TIME_UNKNOWN may not be supported depending on where the TravelEstimate is used. See the documentation of where TravelEstimate is used for any restrictions that might apply.

Throws
java.lang.IllegalArgumentException

if remainingTimeSeconds is a negative value but not REMAINING_TIME_UNKNOWN

setTripIcon

Added in 1.3.0
@RequiresCarApi(value = 5)
fun setTripIcon(tripIcon: CarIcon): TravelEstimate.Builder

Sets a CarIcon that is associated with the current TravelEstimate

See CarIcon for more details related to providing icon and image resources that work with different car screen pixel densities.

Throws
java.lang.NullPointerException

if tripIcon is null

setTripText

Added in 1.3.0
@RequiresCarApi(value = 5)
fun setTripText(tripText: CarText): TravelEstimate.Builder

Sets the trip text.

A text that provides additional information about this TravelEstimate, such as drop off/pick up information, and battery level, that should be displayed on the screen alongside the remaining distance and time.

For example "Pick up Alice", "Drop off Susan", or "Battery Level is Low".

Throws
java.lang.NullPointerException

if tripText is null

java.lang.IllegalArgumentException

if tripText contains unsupported spans

See also
CarText