diff --git a/app/src/main/kotlin/com/tutpro/baresip/Account.kt b/app/src/main/kotlin/com/tutpro/baresip/Account.kt index 25188ac5..75b455f0 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/Account.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/Account.kt @@ -40,7 +40,7 @@ class Account(val accp: Long) { var countryCode = "" var telProvider = Utils.aorDomain(aor) var resumeUri = "" - var numericKeyboard = false + var numericKeypad = false init { @@ -79,7 +79,7 @@ class Account(val accp: Long) { countryCode = Utils.paramValue(extra, "country_code") if (Utils.paramExists(extra, "tel_provider")) telProvider = URLDecoder.decode(Utils.paramValue(extra, "tel_provider"), "UTF-8") - numericKeyboard = Utils.paramExists(extra, "numeric_keyboard") + numericKeypad = Utils.paramExists(extra, "numeric_keypad") } fun print() : String { @@ -169,8 +169,8 @@ class Account(val accp: Long) { if (configuredRegInt != REGISTRATION_INTERVAL) extra += ";regint=$configuredRegInt" - if (numericKeyboard) - extra += ";numeric_keyboard=yes" + if (numericKeypad) + extra += ";numeric_keypad=yes" if (extra !="") res += ";extra=\"" + extra.substringAfter(";") + "\"" diff --git a/app/src/main/kotlin/com/tutpro/baresip/AccountActivity.kt b/app/src/main/kotlin/com/tutpro/baresip/AccountActivity.kt index 1c206132..056b5253 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/AccountActivity.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/AccountActivity.kt @@ -126,6 +126,7 @@ class AccountActivity : ComponentActivity() { private var newTelProvider = "" private var oldDefaultAccount = false private var newDefaultAccount = false + private var newNumericKeypad = false private var arrowTint = Color.Unspecified private var password = mutableStateOf("") private var showPasswordDialog = mutableStateOf(false) @@ -237,6 +238,7 @@ class AccountActivity : ComponentActivity() { newCountryCode = oldCountryCode oldTelProvider = acc.telProvider newTelProvider = oldTelProvider + newNumericKeypad = acc.numericKeypad oldDefaultAccount = UserAgent.findAorIndex(aor)!! == 0 newDefaultAccount = oldDefaultAccount @@ -356,6 +358,7 @@ class AccountActivity : ComponentActivity() { Voicemail() CountryCode() TelProvider() + NumericKeypad() DefaultAccount() AskPassword(ctx) } @@ -1208,6 +1211,33 @@ class AccountActivity : ComponentActivity() { } } + @Composable + fun NumericKeypad() { + Row( + Modifier.fillMaxWidth().padding(end=10.dp), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Start + ) { + Text(text = stringResource(R.string.numeric_keypad), + modifier = Modifier.weight(1f) + .clickable { + alertTitle.value = getString(R.string.numeric_keypad) + alertMessage.value = getString(R.string.numeric_keypad_help) + showAlert.value = true + }, + fontSize = 18.sp, + color = LocalCustomColors.current.itemText) + var numericKeypad by remember { mutableStateOf(acc.numericKeypad) } + Switch( + checked = numericKeypad, + onCheckedChange = { + numericKeypad = it + newNumericKeypad = numericKeypad + } + ) + } + } + @Composable fun DefaultAccount() { Row( @@ -1591,6 +1621,11 @@ class AccountActivity : ComponentActivity() { Log.d(TAG, "New tel provider is ${acc.telProvider}") } + if (newNumericKeypad != acc.numericKeypad) { + acc.numericKeypad = newNumericKeypad + Log.d(TAG, "New numericKeyboard is ${acc.numericKeypad}") + } + val uaIndex = UserAgent.findAorIndex(aor)!! if (newDefaultAccount && (uaIndex > 0)) { val updatedUas = uas.value.toMutableList() diff --git a/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt b/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt index 6e6c4f55..9c9d399d 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt @@ -1083,7 +1083,7 @@ class MainActivity : ComponentActivity() { .onFocusChanged { val account = Account.ofAor(viewModel.selectedAor.value) if (account != null) { - dialpad = account.numericKeyboard + dialpad = account.numericKeypad } }, label = { diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index a76b439f..d6ccac1e 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -223,6 +223,9 @@ voi käyttää soitettaessa puhelinnumeroihin. SIP URI:n domain osa + Numeerinen näppäimistö" + Jos valittu, \"Puhelu ulos …\" kentässä käytetään numeerista + näppäimistöä." Virheellinen SIP URI:n domain-osa \'%1$s\' Oletustili Jos merkitty, niin tämä tili on diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 857dacdf..7f07bf70 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -209,6 +209,9 @@ telephone numbers. SIP URI host part + Numeric Keypad" + If checked, numeric keypad is shown when \"Call to …\" + field is focused." Invalid SIP URI host part \'%1$s\' Default Account If checked, this account is selected when baresip is started.