MapboxScreenManager

class MapboxScreenManager(mainCarContext: MainCarContext, screenProvider: MapboxScreenProvider = MapboxScreenProvider(mainCarContext)) : UIComponent

This is a top level screen manager for a session. Some screens are associated with the CarAppState and whenever the state changes, the screen changes. This makes it possible for the app, such as an Activity, to change the car screen with MapboxCarApp.updateCarAppState.

Some screens do not represent an app state, but rather a user action. For example, the CarSettingsScreen and CarGridFeedbackScreen can be displayed without changing CarAppState. The CarAppState takes priority over the secondary screens.

Usage: Use the MapboxNavigationApp to register the screen manager to a Session lifecycle. As long as the MapboxScreenManager is attached, the car screen will update with CarAppState.

Parameters

mainCarContext

MainCarContext

screenProvider

overridable screen provider

Constructors

Link copied to clipboard
fun MapboxScreenManager(mainCarContext: MainCarContext, screenProvider: MapboxScreenProvider = MapboxScreenProvider(mainCarContext))

Functions

Link copied to clipboard
fun currentScreen(): Screen

Restore the app to MapboxCarApp.carAppState. If the app is in ActiveGuidanceState, the user will expect the head unit to be in ActiveGuidanceState once the car is connected.

Link copied to clipboard
fun handleNewIntent(intent: Intent)

Given an Intent from a Session. This will parse the data and search for places. The results will be shown on the PlacesListOnMapScreen, where the user can select one of the results.

Link copied to clipboard
open override fun onAttached(mapboxNavigation: MapboxNavigation)
Link copied to clipboard
open override fun onDetached(mapboxNavigation: MapboxNavigation)
Link copied to clipboard
fun replaceTop(screen: Screen)

Replace the top screen with a new screen. When the CarAppState changes, the MapboxScreenProvider will provide a screen to this function. The CarAppState will not be bound, when this manager is detached from MapboxNavigationApp.

Properties

Link copied to clipboard
lateinit var coroutineScope: CoroutineScope