diff options
Diffstat (limited to 'wallet')
-rw-r--r-- | wallet/src/main/java/net/taler/wallet/ReceiveFundsFragment.kt | 4 | ||||
-rw-r--r-- | wallet/src/main/java/net/taler/wallet/SendFundsFragment.kt | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/ReceiveFundsFragment.kt b/wallet/src/main/java/net/taler/wallet/ReceiveFundsFragment.kt index 647512c..8ae96ad 100644 --- a/wallet/src/main/java/net/taler/wallet/ReceiveFundsFragment.kt +++ b/wallet/src/main/java/net/taler/wallet/ReceiveFundsFragment.kt @@ -55,6 +55,7 @@ import androidx.fragment.app.activityViewModels import androidx.lifecycle.lifecycleScope import androidx.navigation.fragment.findNavController import net.taler.common.Amount +import net.taler.common.Amount.Companion.isValidAmountStr import net.taler.wallet.exchanges.ExchangeItem class ReceiveFundsFragment : Fragment() { @@ -136,7 +137,8 @@ private fun ReceiveFundsIntro( keyboardOptions = KeyboardOptions.Default.copy(keyboardType = Decimal), onValueChange = { input -> isError = false - text = input.filter { it.isDigit() || it == '.' } + val filtered = input.filter { it.isDigit() || it == '.' } + if (filtered.endsWith('.') || isValidAmountStr(filtered)) text = filtered }, isError = isError, label = { diff --git a/wallet/src/main/java/net/taler/wallet/SendFundsFragment.kt b/wallet/src/main/java/net/taler/wallet/SendFundsFragment.kt index 640fbf7..c5348a3 100644 --- a/wallet/src/main/java/net/taler/wallet/SendFundsFragment.kt +++ b/wallet/src/main/java/net/taler/wallet/SendFundsFragment.kt @@ -52,6 +52,7 @@ import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels import androidx.navigation.fragment.findNavController import net.taler.common.Amount +import net.taler.common.Amount.Companion.isValidAmountStr class SendFundsFragment : Fragment() { private val model: MainViewModel by activityViewModels() @@ -126,7 +127,8 @@ private fun SendFundsIntro( onValueChange = { input -> isError = false insufficientBalance = false - text = input.filter { it.isDigit() || it == '.' } + val filtered = input.filter { it.isDigit() || it == '.' } + if (filtered.endsWith('.') || isValidAmountStr(filtered)) text = filtered }, isError = isError || insufficientBalance, label = { |