DefaultNavigationControlsViewModel
Default implementation of NavigationControlsViewModel that manages the visibility and state of navigation UI controls. Coordinates the display of various navigation components including dashboard, route overview, better route prompt, traffic line, speed info, and map controls (zoom, compass, my location).
Handles complex visibility logic based on:
Navigation state (disabled, free roam, navigation, finished)
Route type (car, pedestrian, bicycle, etc.)
UI state (dashboard collapsed/expanded, route overview shown)
Screen orientation and available space
Important: Call onCleared when this ViewModel is no longer needed to properly release resources and close all connections to prevent memory leaks.
Constructors
Properties
Observable state indicating whether the better route prompt should be visible. Shown when a better route exists and dashboard is collapsed.
Observable state indicating whether the navigation dashboard should be visible. Hidden when navigation is finished, route overview is shown, or when collapsed with better route prompt visible.
Observable state indicating whether the finish route control should be visible. Only shown when navigation state is FINISHED.
Observable state indicating whether indoor navigation controls should be visible. Activated when navigation detects indoor environment.
Timeout in milliseconds after which map controls auto-hide. Set to 0 to disable auto-hiding. Default is 20000 (20 seconds).
Observable state indicating whether map controls (zoom, compass, etc.) should be visible. Automatically hides after mapControlsHideTimeoutMillis unless set to 0.
Observable state indicating whether the minimap should be visible. Shown during navigation (not in free roam, indoor, route overview, or finished states).
Manages the navigation state and route information.
Observable state of the current navigation state. Can be DISABLED, FREE_ROAM, NAVIGATION, or FINISHED.
Observable state indicating whether the route overview mode is active. When true, most other controls are hidden to show the full route.
Observable state indicating whether the speed info should be visible. Shown for car, public transport, bicycle, and scooter routes.
Observable state indicating whether the traffic button should be visible.
Observable state indicating whether the traffic line should be visible. Shown during navigation (not in free roam, indoor, route overview, or finished states).
Functions
Called when the map controls area is touched. Shows map controls and starts a timer to hide them after the configured timeout. If mapControlsHideTimeoutMillis is 0, map controls will not auto-hide.
Updates the dashboard collapsed state. When collapsed with a better route available, the better route prompt is shown instead.
Updates whether a better route is available. Affects dashboard and better route prompt visibility.
Updates the free roam navigation state. In free roam mode, traffic line is hidden and specific map controls may appear.
Updates the minimap visibility state.
Updates whether route overview mode is active. In route overview, most controls are hidden to show the full route.