taler-android

Android apps for GNU Taler (wallet, PoS, cashier)
Log | Files | Refs | README | LICENSE

commit c9a7c750322c3d4957f05ba6b286681398eb7e48
parent 656baddde6e4a530ecb807d90983fa8c20acaa79
Author: Iván Ávalos <avalos@disroot.org>
Date:   Thu,  6 Feb 2025 15:56:56 +0100

[wallet] hide symbol from amount input if it matches currency string

bug 0009494

Diffstat:
Mwallet/src/main/java/net/taler/wallet/compose/AmountInputFIeld.kt | 13++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/wallet/src/main/java/net/taler/wallet/compose/AmountInputFIeld.kt b/wallet/src/main/java/net/taler/wallet/compose/AmountInputFIeld.kt @@ -82,6 +82,8 @@ fun AmountCurrencyField( supportingText = supportingText, readOnly = readOnly, enabled = enabled, + showSymbol = !editableCurrency + || amount.currency != amount.spec?.symbol ) if (editableCurrency) { @@ -106,6 +108,7 @@ private fun AmountInputFieldBase( isError: Boolean = false, readOnly: Boolean = false, enabled: Boolean = true, + showSymbol: Boolean = true, ) { // TODO: use non-deprecated PlatformTextInputModifierNode instead val inputService = LocalTextInputService.current @@ -147,7 +150,7 @@ private fun AmountInputFieldBase( } OutlinedTextField( - value = amount.toString(), + value = amount.toString(showSymbol = showSymbol), onValueChange = {}, modifier = modifier.onKeyEvent { if (it.type == KeyEventType.KeyDown) return@onKeyEvent false @@ -158,11 +161,15 @@ private fun AmountInputFieldBase( } }, readOnly = true, - textStyle = LocalTextStyle.current.copy(fontFamily = FontFamily.Monospace), + textStyle = LocalTextStyle.current.copy( + fontFamily = FontFamily.Monospace, + ), label = label, supportingText = supportingText, isError = isError, - keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.NumberPassword), + keyboardOptions = KeyboardOptions.Default.copy( + keyboardType = KeyboardType.NumberPassword, + ), singleLine = true, maxLines = 1, interactionSource = interactionSource,