ActiveDurationText

fun ActiveDurationText(checkpoint: ExerciseUpdate.ActiveDurationCheckpoint, state: ExerciseState, content: @Composable (Duration) -> Unit = { FormattedDurationText(duration = it) })

Composable to make it easier to create a chronometer from Health Services exercise data.

ActiveDurationText provides a text-based chronometer, which can be styled using the same means as a Text component, and which should only recompose once-per second as the chronometer ticks.

Things to note that ActiveDurationText aims to workaround:

  1. Health Services does not guarantee ExerciseUpdate messages every second, so these must not be used to drive a ticker.

  2. The ActiveDuration delivered in an ExerciseUpdate will not fall on a second-boundary, so the delivery time of these messages cannot be used to determine when to update any content on the screen through a ticker.

Parameters

checkpoint

The checkpoint from the most recent state change. This is supplied in the ExerciseUpdate messages from ExerciseClient.

state

The current state of the exercise. This is supplied in the ExerciseUpdate messages from ExerciseClient.

content

The content slot taking a duration.