VolumeButtonWithBadge

fun VolumeButtonWithBadge(onOutputClick: () -> Unit, imageVector: ImageVector, modifier: Modifier = Modifier, enabled: Boolean = true, alignment: Alignment = Alignment.Center, buttonColors: IconButtonColors = SettingsButtonDefaults.buttonColors(), badgeVector: ImageVector? = null, badgeColors: IconButtonColors = SettingsButtonDefaults.badgeColors(), contentDescription: String = stringResource(ModelR.string.horologist_set_volume_content_description), border: BorderStroke? = null)

A composable function that creates an audio output button with an optional badge.

Parameters

onOutputClick

The callback invoked when the button is clicked.

modifier

The modifier to be applied to the button.

enabled

Controls the enabled state of the button. When false, the button will not respond to user input.

alignment

The alignment of the button within the tap area.

buttonColors

The colors to be used for the button.

badgeColors

The colors to be used for the badge.

contentDescription

The content description to be used for the button.


fun VolumeButtonWithBadge(onOutputClick: () -> Unit, audioOutputUi: AudioOutputUi, volumeUiState: VolumeUiState?, modifier: Modifier = Modifier, enabled: Boolean = true, alignment: Alignment = Alignment.Center, buttonColors: IconButtonColors = SettingsButtonDefaults.buttonColors(), badgeColors: IconButtonColors = SettingsButtonDefaults.badgeColors(), contentDescription: String = stringResource(ModelR.string.horologist_set_volume_content_description), border: BorderStroke? = null)

A composable function that creates an audio output button with an optional badge, dynamically displaying icons based on the audio output and volume states.

The default button's main icon is determined by the audio output's connection status. If the audio output is connected, the button displays the icon provided by the audio output UI state. If the audio output is disconnected, the button displays a "media output off" icon.

The default badge icon, if present, represents the volume level and is only displayed when the audio output is connected. If the volume is at its minimum, the badge displays a mute icon. If the volume is not at its maximum, the badge displays a volume down icon. Otherwise, including when the volume state is null or the volume is at its maximum, the badge displays a volume up icon. If the audio output is disconnected, no badge is displayed.

Parameters

onOutputClick

The callback invoked when the button is clicked.

audioOutputUi

The UI state of the audio output, including connection status and icon.

volumeUiState

The UI state of the volume, used to determine the badge icon.

modifier

The modifier to be applied to the button.

enabled

Controls the enabled state of the button. When false, the button will not respond to user input.

alignment

The alignment of the button within the tap area.

buttonColors

The colors to be used for the button.

badgeColors

The colors to be used for the badge.

contentDescription

The content description to be used for the button.