diff options
Diffstat (limited to 'wallet/src/main/java/net/taler/wallet/transactions/TransactionWithdrawalFragment.kt')
-rw-r--r-- | wallet/src/main/java/net/taler/wallet/transactions/TransactionWithdrawalFragment.kt | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/transactions/TransactionWithdrawalFragment.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionWithdrawalFragment.kt index 14b84b2..2778126 100644 --- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionWithdrawalFragment.kt +++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionWithdrawalFragment.kt @@ -58,14 +58,14 @@ class TransactionWithdrawalFragment : TransactionDetailFragment() { ui.effectiveAmountLabel.text = getString(R.string.withdraw_total) ui.effectiveAmountView.text = t.amountEffective.toString() setupConfirmWithdrawalButton(t) - setupActionButton(t) - ui.chosenAmountLabel.text = getString(R.string.amount_chosen) - ui.chosenAmountView.text = - getString(R.string.amount_positive, t.amountRaw.toString()) - val fee = t.amountRaw - t.amountEffective - ui.feeView.text = getString(R.string.amount_negative, fee.toString()) - ui.exchangeView.text = cleanExchange(t.exchangeBaseUrl) - if (t.pending) { + setupActionButton(t) + ui.chosenAmountLabel.text = getString(R.string.amount_chosen) + ui.chosenAmountView.text = + getString(R.string.amount_positive, t.amountRaw.toString()) + val fee = t.amountRaw - t.amountEffective + ui.feeView.text = getString(R.string.amount_negative, fee.toString()) + ui.exchangeView.text = cleanExchange(t.exchangeBaseUrl) + if (t.pending) { ui.deleteButton.setIconResource(R.drawable.ic_cancel) ui.deleteButton.setText(R.string.cancel) } @@ -75,13 +75,15 @@ class TransactionWithdrawalFragment : TransactionDetailFragment() { } } + private val isPending get() = transactionManager.selectedTransaction.value?.pending == true + override val deleteDialogTitle: Int - get() = if (transactionManager.selectedTransaction.value?.pending == true) R.string.cancel else super.deleteDialogTitle + get() = if (isPending) R.string.cancel else super.deleteDialogTitle override val deleteDialogMessage: Int - get() = if (transactionManager.selectedTransaction.value?.pending == true) R.string.transactions_cancel_dialog_message + get() = if (isPending) R.string.transactions_cancel_dialog_message else super.deleteDialogMessage override val deleteDialogButton: Int - get() = if (transactionManager.selectedTransaction.value?.pending == true) R.string.ok else super.deleteDialogButton + get() = if (isPending) R.string.ok else super.deleteDialogButton private fun setupConfirmWithdrawalButton(t: TransactionWithdrawal) { if (t.pending && !t.confirmed) { |