RoutePreviewNavigationTemplate
public
final
class
RoutePreviewNavigationTemplate
extends Object
implements
Template
java.lang.Object | |
↳ | androidx.car.app.navigation.model.RoutePreviewNavigationTemplate |
A template that supports showing a list of routes alongside a custom drawn map.
The list must have its ItemList.OnSelectedListener
set, and the template
must have its navigate action set (see RoutePreviewNavigationTemplate.Builder.setNavigateAction(Action)
). These are used in
conjunction to inform the app that:
- A route has been selected. The app should also highlight the route on the map surface.
- A navigate action has been triggered. The app should begin navigation using the selected route.
The template itself does not expose a drawing surface. In order to draw on the canvas, use
AppManager.setSurfaceCallback(SurfaceCallback)
.
Template Restrictions
In regards to template refreshes, as described inScreen.onGetTemplate()
, this template
is considered a refresh of a previous one if:
- The template title has not changed, and
- The previous template is in a loading state (see
RoutePreviewNavigationTemplate.Builder.setLoading(boolean)
, or the number of rows and the string contents (title, texts, not counting spans) of each row between the previous and newItemList
s have not changed.
Note that specifically, this means the app can't use this template to continuously refresh the routes as the car moves without hitting the template limit.
In order to use this template your car app MUST declare that it uses the androidx.car.app.NAVIGATION_TEMPLATES
permission in the manifest.
Summary
Nested classes | |
---|---|
class |
RoutePreviewNavigationTemplate.Builder
A builder of |
Public methods | |
---|---|
boolean
|
equals(Object other)
|
ActionStrip
|
getActionStrip()
Returns the |
Action
|
getHeaderAction()
Returns the |
ItemList
|
getItemList()
Returns the |
Action
|
getNavigateAction()
Returns the |
CarText
|
getTitle()
Returns the title of the template or |
int
|
hashCode()
|
boolean
|
isLoading()
Returns whether the template is loading. |
String
|
toString()
|
Inherited methods | |
---|---|
Public methods
equals
public boolean equals (Object other)
Parameters | |
---|---|
other |
Object |
Returns | |
---|---|
boolean |
getActionStrip
public ActionStrip getActionStrip ()
Returns the ActionStrip
for this template or null
if not set.
Returns | |
---|---|
ActionStrip |
getHeaderAction
public Action getHeaderAction ()
Returns the Action
that is set to be displayed in the header of the template or
null
if not set.
Returns | |
---|---|
Action |
getItemList
public ItemList getItemList ()
Returns the ItemList
to show route options in a list view along with the map or
null
if not set.
Returns | |
---|---|
ItemList |
getNavigateAction
public Action getNavigateAction ()
Returns the Action
to allow users to request navigation using the currently selected
route or null
if not set.
Returns | |
---|---|
Action |
getTitle
public CarText getTitle ()
Returns the title of the template or null
if not set.
Returns | |
---|---|
CarText |
hashCode
public int hashCode ()
Returns | |
---|---|
int |
isLoading
public boolean isLoading ()
Returns whether the template is loading.
Returns | |
---|---|
boolean |
toString
public String toString ()
Returns | |
---|---|
String |
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2021-03-24 UTC.