|
|
|
|
@ -249,7 +249,7 @@ private fun RadioPttButton(
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Единый выбор входа/выхода и переключатель плавающей PTT-кнопки. */ |
|
|
|
|
/* Единый выбор входа/выхода, VAD и плавающая PTT-кнопка. */ |
|
|
|
|
@Composable |
|
|
|
|
private fun RadioSourceBar(viewModel: ChatViewModel) { |
|
|
|
|
val radioAuto by viewModel.radioAuto.collectAsState() |
|
|
|
|
@ -260,6 +260,7 @@ private fun RadioSourceBar(viewModel: ChatViewModel) {
|
|
|
|
|
val provider = ChatApplication.instance.configProvider |
|
|
|
|
val scope = rememberCoroutineScope() |
|
|
|
|
val overlayEnabled by provider.radioOverlayEnabled.collectAsState(initial = provider.getRadioOverlay()) |
|
|
|
|
val vadEnabled by provider.radioVadEnabled.collectAsState(initial = provider.getInt("radio.vad_enabled") != 0) |
|
|
|
|
val overlayShown by RadioOverlayService.isShown.collectAsState() |
|
|
|
|
val overlayStatus by RadioOverlayService.status.collectAsState() |
|
|
|
|
|
|
|
|
|
@ -299,6 +300,10 @@ private fun RadioSourceBar(viewModel: ChatViewModel) {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
VerticalDivider(modifier = Modifier.height(32.dp), color = Color(0xFF344550)) |
|
|
|
|
RadioControlButton(null, stringResource(if (vadEnabled) R.string.disable_vad else R.string.enable_vad), |
|
|
|
|
vadEnabled, text = stringResource(R.string.vad_button)) { |
|
|
|
|
viewModel.setRadioVad(!vadEnabled) |
|
|
|
|
} |
|
|
|
|
RadioControlButton(null, stringResource(R.string.floating_ptt), overlayShown, floating = true) { |
|
|
|
|
scope.launch { |
|
|
|
|
if (overlayEnabled && !overlayShown) RadioOverlayService.requestPermissions() |
|
|
|
|
@ -317,7 +322,7 @@ private fun RadioSourceBar(viewModel: ChatViewModel) {
|
|
|
|
|
@Composable |
|
|
|
|
private fun RadioControlButton( |
|
|
|
|
icon: ImageVector?, label: String, active: Boolean, |
|
|
|
|
centerIcon: ImageVector? = null, bluetooth: Boolean = false, floating: Boolean = false, onClick: () -> Unit |
|
|
|
|
centerIcon: ImageVector? = null, bluetooth: Boolean = false, floating: Boolean = false, text: String? = null, onClick: () -> Unit |
|
|
|
|
) { |
|
|
|
|
IconToggleButton( |
|
|
|
|
checked = active, |
|
|
|
|
@ -327,6 +332,10 @@ private fun RadioControlButton(
|
|
|
|
|
containerColor = Color(0xFF24323D), contentColor = Color(0xFFAEBCC8), |
|
|
|
|
checkedContainerColor = Color(0xFF1F6FEB), checkedContentColor = Color.White) |
|
|
|
|
) { |
|
|
|
|
if (text != null) { |
|
|
|
|
Text(text, fontSize = 12.sp, modifier = Modifier.semantics { contentDescription = label }) |
|
|
|
|
return@IconToggleButton |
|
|
|
|
} |
|
|
|
|
if (floating) { |
|
|
|
|
RadioFloatingIcon(label) |
|
|
|
|
return@IconToggleButton |
|
|
|
|
|