NavigationLayoutDelegate

public abstract class NavigationLayoutDelegate extends Object

Definition of a layout delegate that you implement to build and manage your custom navigation UI layout. Pass your implementation to NavigationView or SupportNavigationFragment. Each of its methods will be called on the main thread by the Navigation SDK on their corresponding events.

Public Constructor Summary

Public Method Summary

void
onChangePrompt(NavigationUiParent navigationUiParent, View oldPrompt, View newPrompt)
Replaces a prompt that is currently being displayed in the navigation layout with a different prompt.
void
onEnterActiveGuidance(NavigationUiParent navigationUiParent, NavigationReadyUiState oldState, ActiveGuidanceUiState newState)
Sets up the navigation UI for the Active Guidance state.
abstract void
onEnterNavigationReady(NavigationUiParent navigationUiParent, NavigationReadyUiState newState)
Sets up the navigation UI for the Navigation Ready state.
void
onHidePrompt(NavigationUiParent navigationUiParent, View oldPrompt)
Hides a prompt that is currently being displayed in the navigation layout.
void
onLeaveActiveGuidance(NavigationUiParent navigationUiParent, ActiveGuidanceUiState oldState, NavigationReadyUiState newState)
Cleans up the navigation UI when leaving the Active Guidance state.
abstract void
onLeaveNavigationReady(NavigationUiParent navigationUiParent, NavigationReadyUiState oldState)
Cleans up the navigation UI when leaving the Navigation Ready state.
void
onShowPrompt(NavigationUiParent navigationUiParent, View newPrompt)
Adds a prompt to the navigation layout.
void
onSizeChanged(NavigationUiParent navigationUiParent, UiState state)
Updates the navigation UI after a change to the map size or, less commonly, after a global configuration change for which Activity re-creation has been overridden.

Inherited Method Summary

Public Constructors

public NavigationLayoutDelegate ()

Public Methods

public void onChangePrompt (NavigationUiParent navigationUiParent, View oldPrompt, View newPrompt)

Replaces a prompt that is currently being displayed in the navigation layout with a different prompt.

This method will be called from the main thread and should not perform any long-running operations.

To prevent memory leaks, don't hold a reference to NavigationUiParent.

Parameters
navigationUiParent the view that hosts the navigation UI
oldPrompt the prompt that is currently displayed which should be removed from the layout
newPrompt the new prompt to be added to the layout

public void onEnterActiveGuidance (NavigationUiParent navigationUiParent, NavigationReadyUiState oldState, ActiveGuidanceUiState newState)

Sets up the navigation UI for the Active Guidance state.

This method will be called from the main thread and should not perform any long-running operations.

To prevent memory leaks, don't hold a reference to NavigationUiParent.

Parameters
navigationUiParent the view that hosts the navigation UI
oldState the state object which contains all UI elements for the Navigation Ready state, some of which may need to be removed from the layout
newState the state object which contains all valid UI elements which may be added to the layout for the Active Guidance state

public abstract void onEnterNavigationReady (NavigationUiParent navigationUiParent, NavigationReadyUiState newState)

Sets up the navigation UI for the Navigation Ready state. This method should always be implemented, and at minimum must add all required UI elements to a layout which is set on the NavigationUiParent.

This method will be called from the main thread and should not perform any long-running operations.

To prevent memory leaks, don't hold a reference to NavigationUiParent.

Parameters
navigationUiParent the Navigation UI parent
newState the state object which contains all valid UI elements which may be added to the layout for the Navigation Ready state

public void onHidePrompt (NavigationUiParent navigationUiParent, View oldPrompt)

Hides a prompt that is currently being displayed in the navigation layout.

This method will be called from the main thread and should not perform any long-running operations.

To prevent memory leaks, don't hold a reference to NavigationUiParent.

Parameters
navigationUiParent the Navigation UI parent
oldPrompt the prompt that is currently displayed which should be removed from the layout

public void onLeaveActiveGuidance (NavigationUiParent navigationUiParent, ActiveGuidanceUiState oldState, NavigationReadyUiState newState)

Cleans up the navigation UI when leaving the Active Guidance state.

This method will be called from the main thread and should not perform any long-running operations.

To prevent memory leaks, don't hold a reference to NavigationUiParent.

Parameters
navigationUiParent the view that hosts the navigation UI
oldState the ActiveGuidanceUiState being left
newState the NavigationReadyUiState for the Navigation Ready state being entered

public abstract void onLeaveNavigationReady (NavigationUiParent navigationUiParent, NavigationReadyUiState oldState)

Cleans up the navigation UI when leaving the Navigation Ready state. This method should always be implemented.

This method will be called from the main thread and should not perform any long-running operations.

To prevent memory leaks, don't hold a reference to NavigationUiParent.

Parameters
navigationUiParent the Navigation UI parent
oldState the state object which contains all UI elements for the Navigation Ready state which should be removed from the layout

public void onShowPrompt (NavigationUiParent navigationUiParent, View newPrompt)

Adds a prompt to the navigation layout.

This method will be called from the main thread and should not perform any long-running operations.

To prevent memory leaks, don't hold a reference to NavigationUiParent.

Parameters
navigationUiParent the view that hosts the navigation UI
newPrompt the prompt View to be added to the layout

public void onSizeChanged (NavigationUiParent navigationUiParent, UiState state)

Updates the navigation UI after a change to the map size or, less commonly, after a global configuration change for which Activity re-creation has been overridden. Note that the value of UiState.isWideMode() may have changed since the last call to the layout delegate.

This method will be called from the main thread and should not perform any long-running operations.

To prevent memory leaks, don't hold a reference to NavigationUiParent.

Parameters
navigationUiParent the view that hosts the navigation UI
state the state object which contains the UI elements as well as the current value of wide mode