diff options
author | Iván Ávalos <avalos@disroot.org> | 2023-02-11 12:07:13 -0600 |
---|---|---|
committer | Torsten Grote <t@grobox.de> | 2023-02-14 15:59:21 -0300 |
commit | c0d94e7a240e97198eacdd33719c5983591bf219 (patch) | |
tree | 29b18e208b67e972cdf124c0875c6ee484671e8e | |
parent | c8de14a77f88de8edd2a75e030bfc4dbd80785c8 (diff) | |
download | taler-android-c0d94e7a240e97198eacdd33719c5983591bf219.tar.gz taler-android-c0d94e7a240e97198eacdd33719c5983591bf219.tar.bz2 taler-android-c0d94e7a240e97198eacdd33719c5983591bf219.zip |
[wallet] Add Confirm with Bank button to transactions list
#0007676
3 files changed, 30 insertions, 11 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt index fa30f5c..e65a751 100644 --- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt +++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt @@ -127,11 +127,21 @@ internal class TransactionAdapter( } } - private fun bindActionButton(transaction: Transaction) { - actionButton.visibility = transaction.handleKyc({ GONE }) { - actionButton.setOnClickListener { listener.onActionButtonClicked(transaction) } - actionButton.setText(R.string.transaction_action_kyc) - VISIBLE + private fun bindActionButton(t: Transaction) { + actionButton.setOnClickListener { listener.onActionButtonClicked(t) } + if (t.error != null) { + actionButton.visibility = t.handleKyc({ GONE }) { + actionButton.setText(R.string.transaction_action_kyc) + VISIBLE + } + } else if (t is TransactionWithdrawal && !t.confirmed) { + actionButton.setIconResource(R.drawable.ic_account_balance) + actionButton.visibility = + if (t.withdrawalDetails is WithdrawalDetails.TalerBankIntegrationApi && + t.withdrawalDetails.bankConfirmationUrl != null) { + actionButton.setText(R.string.withdraw_button_confirm_bank) + VISIBLE + } else GONE } } diff --git a/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt index 08281c4..d67d9b3 100644 --- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt +++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt @@ -180,10 +180,17 @@ class TransactionsFragment : Fragment(), OnTransactionClickListener, ActionMode. } } - override fun onActionButtonClicked(transaction: Transaction) { - transaction.handleKyc({ error("Unhandled Action Button Event") }) { error -> - error.kycUrl?.let { - launchInAppBrowser(requireContext(), it) + override fun onActionButtonClicked(t: Transaction) { + if (t.error != null) { + t.handleKyc({ error("Unhandled Action Button Event") }) { error -> + error.kycUrl?.let { + launchInAppBrowser(requireContext(), it) + } + } + } else if (t is TransactionWithdrawal && !t.confirmed) { + if (t.withdrawalDetails is WithdrawalDetails.TalerBankIntegrationApi && + t.withdrawalDetails.bankConfirmationUrl != null) { + launchInAppBrowser(requireContext(), t.withdrawalDetails.bankConfirmationUrl) } } } diff --git a/wallet/src/main/res/layout/list_item_transaction.xml b/wallet/src/main/res/layout/list_item_transaction.xml index 5dfdf14..8cd10a8 100644 --- a/wallet/src/main/res/layout/list_item_transaction.xml +++ b/wallet/src/main/res/layout/list_item_transaction.xml @@ -66,9 +66,11 @@ android:id="@+id/actionButton" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginTop="8dp" android:visibility="gone" - android:textColor="?colorOnTertiary" - app:backgroundTint="?colorTertiary" + android:textColor="?colorOnPrimary" + app:iconTint="?colorOnPrimary" + app:backgroundTint="?colorPrimary" app:layout_constraintStart_toStartOf="@id/title" app:layout_constraintTop_toBottomOf="@id/extraInfoView" tools:text="Complete KYC" |