aboutsummaryrefslogtreecommitdiff
path: root/wallet/src
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2020-09-03 09:23:11 -0300
committerTorsten Grote <t@grobox.de>2020-09-03 09:23:11 -0300
commitd56c5eaa5ea01225259486dab48b3c24e341b74c (patch)
tree71f84744ef0b42b863e92127b4de955006dddb4f /wallet/src
parent36821f996fddc80681b0fef9f057b0065c738418 (diff)
downloadtaler-android-d56c5eaa5ea01225259486dab48b3c24e341b74c.tar.gz
taler-android-d56c5eaa5ea01225259486dab48b3c24e341b74c.tar.bz2
taler-android-d56c5eaa5ea01225259486dab48b3c24e341b74c.zip
Don't crash on empty manual withdrawal amount
Diffstat (limited to 'wallet/src')
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt2
-rw-r--r--wallet/src/main/java/net/taler/wallet/withdraw/ManualWithdrawFragment.kt19
-rw-r--r--wallet/src/main/res/values/strings.xml1
3 files changed, 14 insertions, 8 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt b/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt
index db3f283..0817c36 100644
--- a/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt
@@ -190,9 +190,7 @@ class TransactionRefund(
*/
val amountInvalid: Amount? = null,
override val error: TalerErrorInfo? = null,
- @SerialName("amountEffective") // TODO remove when fixed in wallet-core
override val amountRaw: Amount,
- @SerialName("amountRaw") // TODO remove when fixed in wallet-core
override val amountEffective: Amount
) : Transaction() {
override val icon = R.drawable.transaction_refund
diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/ManualWithdrawFragment.kt b/wallet/src/main/java/net/taler/wallet/withdraw/ManualWithdrawFragment.kt
index fbee6ae..af76e9b 100644
--- a/wallet/src/main/java/net/taler/wallet/withdraw/ManualWithdrawFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/withdraw/ManualWithdrawFragment.kt
@@ -55,13 +55,20 @@ class ManualWithdrawFragment : Fragment() {
}.joinToString(separator = "\n", prefix = "• ")
paymentOptionsLabel.text =
getString(R.string.withdraw_manual_payment_options, exchangeItem.name, paymentOptions)
- checkFeesButton.setOnClickListener {
- val value = amountView.text.toString().toLong()
- val amount = Amount(exchangeItem.currency, value, 0)
- amountView.hideKeyboard()
- Toast.makeText(view.context, "Not implemented: $amount", LENGTH_SHORT).show()
- withdrawManager.getWithdrawalDetails(exchangeItem.exchangeBaseUrl, amount)
+ checkFeesButton.setOnClickListener { onCheckFees() }
+ }
+
+ private fun onCheckFees() {
+ if (amountView.text?.isEmpty() ?: true) {
+ amountLayout.setError(getString(R.string.withdraw_amount_error))
+ return
}
+ amountLayout.setError(null)
+ val value = amountView.text.toString().toLong()
+ val amount = Amount(exchangeItem.currency, value, 0)
+ amountView.hideKeyboard()
+ Toast.makeText(requireContext(), "Not implemented: $amount", LENGTH_SHORT).show()
+ withdrawManager.getWithdrawalDetails(exchangeItem.exchangeBaseUrl, amount)
}
}
diff --git a/wallet/src/main/res/values/strings.xml b/wallet/src/main/res/values/strings.xml
index a9f6c73..a780ad3 100644
--- a/wallet/src/main/res/values/strings.xml
+++ b/wallet/src/main/res/values/strings.xml
@@ -113,6 +113,7 @@ GNU Taler is immune against many types of fraud, such as phishing of credit card
<string name="withdraw_waiting_confirm">Waiting for confirmation</string>
<string name="withdraw_manual_title">Make a manual transfer to the exchange</string>
<string name="withdraw_amount">How much to withdraw?</string>
+ <string name="withdraw_amount_error">Enter valid amount</string>
<string name="withdraw_manual_payment_options">Payment options supported by %1$s:\n\n%2$s</string>
<string name="withdraw_manual_check_fees">Check fees</string>
<string name="withdraw_error_title">Withdrawal Error</string>