LevelReadinessDistributor

class LevelReadinessDistributor(context: Context, dispatcher: CoroutineDispatcher = Dispatchers.Main)

LevelReadinessDistributor is responsible for distributing level readiness events to listeners.

Parameters

context

The context of the application

dispatcher

The dispatcher that is used to listen on

Constructors

Link copied to clipboard
constructor(context: Context, dispatcher: CoroutineDispatcher = Dispatchers.Main)

Properties

Link copied to clipboard
val horizontalRotation: StateFlow<Float>

The current horizontal rotation of the device

Link copied to clipboard
val level: StateFlow<Level>

The current level state of device Refer to the LevelReadiness enum for the different states

Link copied to clipboard
val verticalRotation: StateFlow<Float>

The current vertical rotation of the device

Functions

Link copied to clipboard
fun reset()

This method resets the LevelReadinessDistributor to its initial state.

Link copied to clipboard

This method starts listening for motion events from the MotionManager and notifies the listeners when they occur.

Link copied to clipboard

This method stops listening for motion events from the MotionManager. This should be called when the MotionDistributor is no longer needed.