TravelEstimate.Builder
public final class TravelEstimate.Builder
A builder of TravelEstimate.
Summary
Public constructors |
|---|
Builder(Constructs a new builder of |
@RequiresApi(value = 26)Constructs a new builder of |
Public methods |
|
|---|---|
@NonNull TravelEstimate |
build()Constructs the |
@NonNull TravelEstimate.Builder |
setRemainingDistanceColor(@NonNull CarColor remainingDistanceColor)Sets the color of the remaining distance text. |
@NonNull TravelEstimate.Builder |
@RequiresApi(value = 26)Sets the estimated time remaining until arriving at the destination. |
@NonNull TravelEstimate.Builder |
setRemainingTimeColor(@NonNull CarColor remainingTimeColor)Sets the color of the remaining time text. |
@NonNull TravelEstimate.Builder |
setRemainingTimeSeconds(@IntRange(from = "-1") long remainingTimeSeconds)Sets the estimated time remaining until arriving at the destination, in seconds. |
@NonNull TravelEstimate.Builder |
@RequiresCarApi(value = 5)Sets a |
@NonNull TravelEstimate.Builder |
@RequiresCarApi(value = 5)Sets the trip text. |
Public constructors
Builder
public Builder(
@NonNull Distance remainingDistance,
@NonNull DateTimeWithZone arrivalTimeAtDestination
)
Constructs a new builder of TravelEstimate.
| Parameters | |
|---|---|
@NonNull Distance remainingDistance |
The estimated remaining |
@NonNull DateTimeWithZone arrivalTimeAtDestination |
The arrival time with the time zone information provided for the destination |
| Throws | |
|---|---|
java.lang.NullPointerException |
if |
Builder
@RequiresApi(value = 26)
public Builder(
@NonNull Distance remainingDistance,
@NonNull ZonedDateTime arrivalTimeAtDestination
)
Constructs a new builder of TravelEstimate.
| Parameters | |
|---|---|
@NonNull Distance remainingDistance |
The estimated remaining |
@NonNull ZonedDateTime arrivalTimeAtDestination |
The arrival time with the time zone information provided for the destination |
| Throws | |
|---|---|
java.lang.NullPointerException |
if |
Public methods
build
public @NonNull TravelEstimate build()
Constructs the TravelEstimate defined by this builder.
setRemainingDistanceColor
public @NonNull TravelEstimate.Builder setRemainingDistanceColor(@NonNull CarColor remainingDistanceColor)
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 |
java.lang.NullPointerException |
if |
setRemainingTime
@RequiresApi(value = 26)
public @NonNull TravelEstimate.Builder setRemainingTime(@NonNull Duration remainingTime)
Sets the estimated time remaining until arriving at the destination.
If not set, REMAINING_TIME_UNKNOWN will be used.
| Throws | |
|---|---|
java.lang.IllegalArgumentException |
if |
java.lang.NullPointerException |
if |
setRemainingTimeColor
public @NonNull TravelEstimate.Builder setRemainingTimeColor(@NonNull CarColor remainingTimeColor)
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 |
java.lang.NullPointerException |
if |
setRemainingTimeSeconds
public @NonNull TravelEstimate.Builder setRemainingTimeSeconds(@IntRange(from = "-1") long remainingTimeSeconds)
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 |
setTripIcon
@RequiresCarApi(value = 5)
public @NonNull TravelEstimate.Builder setTripIcon(@NonNull CarIcon tripIcon)
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 |
setTripText
@RequiresCarApi(value = 5)
public @NonNull TravelEstimate.Builder setTripText(@NonNull CarText tripText)
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 |
java.lang.IllegalArgumentException |
if |
| See also | |
|---|---|
CarText |