Fixed handling of DTMF backspace character

This commit is contained in:
Juha Heinanen
2025-04-09 08:21:54 +03:00
parent 08adc5dc85
commit f514f19755
@@ -1424,16 +1424,16 @@ class MainActivity : ComponentActivity() {
val shouldRequestFocus by focusDtmf val shouldRequestFocus by focusDtmf
TextField( TextField(
value = dtmfText.value, value = dtmfText.value,
onValueChange = { newText -> onValueChange = {
if (newText.length > dtmfText.value.length) { if (it.length > dtmfText.value.length) {
val char = newText.last() val char = it.last()
Log.d(TAG, "Got DTMF digit '$char'")
if (char.isDigit() || char == '*' || char == '#') { if (char.isDigit() || char == '*' || char == '#') {
dtmfText.value = newText Log.d(TAG, "Got DTMF digit '$char'")
ua = UserAgent.ofAor(viewModel.selectedAor.value)!! ua = UserAgent.ofAor(viewModel.selectedAor.value)!!
ua.currentCall()!!.sendDigit(char) ua.currentCall()!!.sendDigit(char)
} }
} }
dtmfText.value = it
}, },
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Phone), keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Phone),
modifier = Modifier modifier = Modifier