Package-level declarations

Types

Link copied to clipboard
sealed interface AmbientState

Represent Ambient as updates, with the state and time of change. This is necessary to ensure that when the system provides a (typically) 1min-frequency callback to onUpdateAmbient, the developer may wish to update composables, but the state hasn't changed.

Properties

Link copied to clipboard

AmbientState represents the current state of an ambient effect. It defaults to AmbientState.Inactive if no state is provided.

Functions

Link copied to clipboard
fun AmbientAware(lifecycle: Lifecycle = LocalLifecycleOwner.current.lifecycle, content: @Composable (AmbientState) -> Unit)

Composable for general handling of changes and updates to ambient status. A new AmbientState is generated with any change of ambient state, as well as with any periodic update generated whilst the screen is in ambient mode.

Link copied to clipboard
fun AmbientAwareTime(stateUpdate: AmbientState, updatePeriodMillis: Long = 1000, block: @Composable (dateTime: ZonedDateTime, isAmbient: Boolean) -> Unit)

An example of using AmbientAware: Provides the time, at the specified update frequency, whilst in interactive mode, or when ambient-generated updates occur (typically every 1 min).