DefaultSoundSettingsViewModel

Default implementation of SoundSettingsViewModel.

Backed by a NavigationSettingsRepository: each property reactively maps one or more repository keys, and each setter writes through to the repository (which in turn drives NavigationSettingsApplier).

setSoundMode performs an atomic multi-key update so that switching the master mode re-applies the correct defaults for every dependent toggle.

Important: Call onCleared when the screen is destroyed to release the internal coroutine scope. When used via ru.dgis.sdk.compose.navigation.controls.defaultcontrols.navigation.DefaultNavigationControlsState, onCleared is called automatically. If used standalone, you must call it manually.

Parameters

settingsRepository

Repository for reading and persisting sound settings.

Constructors

Link copied to clipboard
constructor(settingsRepository: NavigationSettingsRepository)

Properties

Link copied to clipboard
open override val camerasEvents: StateFlow<EnumSet<CamerasEvent>>

Set of currently enabled camera-warning events.

Link copied to clipboard
open override val otherEvents: StateFlow<EnumSet<OtherEvent>>

Set of currently enabled non-camera event warnings.

Link copied to clipboard
open override val soundMode: StateFlow<SoundMode>

Current master sound mode.

Link copied to clipboard
open override val soundVolume: StateFlow<Int>

Master output volume in the range 0..100.

Link copied to clipboard
open override val speedExceeding: StateFlow<Boolean>

Whether the speed-exceeding warning is enabled.

Link copied to clipboard
open override val speedExceedingThresholdsKph: StateFlow<Int>

Speed-exceeding threshold in km/h (negative values represent driving below the limit).

Functions

Link copied to clipboard
open override fun onCleared()

Release resources. Must be called when the screen is destroyed.

Link copied to clipboard
open override fun setCamerasEvent(camerasEvent: CamerasEvent, state: Boolean)

Toggle a single camera event on or off.

Link copied to clipboard
open override fun setCamerasEvents(camerasEvents: EnumSet<CamerasEvent>)

Replace the full set of enabled camera events.

Link copied to clipboard
open override fun setOtherEvent(otherEvent: OtherEvent, state: Boolean)

Toggle a single non-camera event on or off.

Link copied to clipboard
open override fun setOtherEvents(otherEvents: EnumSet<OtherEvent>)

Replace the full set of enabled non-camera events.

Link copied to clipboard
open override fun setSoundMode(type: SoundMode)

Set the master sound mode. Switching modes also resets the camera/event toggles and speed-exceeding flag to mode defaults.

Link copied to clipboard
open override fun setSoundVolume(volume: Int)

Set master output volume. The value is coerced into 0..100.

Link copied to clipboard
open override fun setSpeedExceedingEnabled(enabled: Boolean)

Enable or disable the speed-exceeding warning.

Link copied to clipboard
open override fun setSpeedExceedingThresholdsKph(thresholdsKph: Int)

Set the speed-exceeding threshold in km/h.