RoutingInfo.Builder
public final class RoutingInfo.Builder
A builder of RoutingInfo.
Summary
Public methods |
|
|---|---|
@NonNull RoutingInfo |
build()Constructs the |
@NonNull RoutingInfo.Builder |
setCurrentStep(Sets the current |
@NonNull RoutingInfo.Builder |
setJunctionImage(@NonNull CarIcon junctionImage)Sets an image of a junction for the maneuver. |
@NonNull RoutingInfo.Builder |
setLoading(boolean isLoading)Sets whether the |
@NonNull RoutingInfo.Builder |
setNextStep(@NonNull Step nextStep)Sets the next |
Public methods
build
public @NonNull RoutingInfo build()
Constructs the RoutingInfo defined by this builder.
RoutingInfo can be in a loading state by passing true to setLoading, in which case no other fields may be set. Otherwise, the current step and distance must be set. If the lane information is set with addLane, then the lane image must also be set with setLanesImage.
| Throws | |
|---|---|
java.lang.IllegalStateException |
if the |
setCurrentStep
public @NonNull RoutingInfo.Builder setCurrentStep(
@NonNull Step currentStep,
@NonNull Distance currentDistance
)
Sets the current Step and Distance to display in the template.
A Step with a Maneuver of type TYPE_UNKNOWN will shown here with the given icon.
Step object, set with setCue, can contain image spans. To minimize scaling artifacts across a wide range of car screens, apps should provide images targeting a 216 x 72 dp bounding box. If necessary, those images in the spans will be scaled down to fit the bounding box while preserving their aspect ratios.
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 |
java.lang.NullPointerException |
if |
setJunctionImage
public @NonNull RoutingInfo.Builder setJunctionImage(@NonNull CarIcon junctionImage)
Sets an image of a junction for the maneuver.
For example, a photo-realistic view of the upcoming junction that the driver can see when executing the maneuver.
Image Sizing Guidance To minimize scaling artifacts across a wide range of car screens, apps should provide images targeting a 500 x 312 dp bounding box. If the image exceeds this maximum size in either one of the dimensions, it will be scaled down to be centered inside the bounding box while preserving its aspect ratio. The aspect ratio should be greater than or equal to 1.6 in order to fit the horizontal space fully.On smaller screens the junction image may result in the hiding of the Lane s, TravelEstimate or next Step.
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 |
setLoading
public @NonNull RoutingInfo.Builder setLoading(boolean isLoading)
Sets whether the RoutingInfo is in a loading state.
If set to true, the UI will show a loading indicator, and adding any other routing info will throw an IllegalArgumentException. The caller is expected to call invalidate and send the new template content to the host once the data is ready. If set to false, the UI shows the actual routing info.
setNextStep
public @NonNull RoutingInfo.Builder setNextStep(@NonNull Step nextStep)
Sets the next Step.
Unless set with this method, the next step won't be displayed.
Image Sizing Guidance Images in the cue of theStep object, set with setCue, can contain image spans. To minimize scaling artifacts across a wide range of car screens, apps should provide images targeting a 216 x 72 dp bounding box. If necessary, those images in the spans will be scaled down to fit the bounding box while preserving their aspect ratios.
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 |