diff options
author | Iván Ávalos <avalos@disroot.org> | 2023-01-16 22:39:18 -0600 |
---|---|---|
committer | Torsten Grote <t@grobox.de> | 2023-01-17 12:05:23 -0300 |
commit | 9049e305ac376d7e04b8190c9f65f6efe24562b1 (patch) | |
tree | 581401754872dee0e03df1c541469cbd88ffc92d /wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt | |
parent | 0bf92f7636e27da2b30f680550f3ee9eaede56ec (diff) | |
download | taler-android-9049e305ac376d7e04b8190c9f65f6efe24562b1.tar.gz taler-android-9049e305ac376d7e04b8190c9f65f6efe24562b1.tar.bz2 taler-android-9049e305ac376d7e04b8190c9f65f6efe24562b1.zip |
[wallet] Initial implementation of KYC handling
#0007566
Diffstat (limited to 'wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt')
-rw-r--r-- | wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt | 16 |
1 files changed, 16 insertions, 0 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 b11f438..c4ec060 100644 --- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt +++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt @@ -32,6 +32,7 @@ import androidx.recyclerview.selection.SelectionTracker import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView.Adapter import androidx.recyclerview.widget.RecyclerView.ViewHolder +import com.google.android.material.button.MaterialButton import net.taler.common.exhaustive import net.taler.common.toRelativeTime import net.taler.wallet.R @@ -78,6 +79,7 @@ internal class TransactionAdapter( private val icon: ImageView = v.findViewById(R.id.icon) private val title: TextView = v.findViewById(R.id.title) private val extraInfoView: TextView = v.findViewById(R.id.extraInfoView) + private val actionButton: MaterialButton = v.findViewById(R.id.actionButton) private val time: TextView = v.findViewById(R.id.time) private val amount: TextView = v.findViewById(R.id.amount) private val pendingView: TextView = v.findViewById(R.id.pendingView) @@ -95,6 +97,7 @@ internal class TransactionAdapter( } title.text = transaction.getTitle(context) bindExtraInfo(transaction) + bindActionButton(transaction) time.text = transaction.timestamp.ms.toRelativeTime(context) bindAmount(transaction) pendingView.visibility = if (transaction.pending) VISIBLE else GONE @@ -123,6 +126,19 @@ internal class TransactionAdapter( } } + private fun bindActionButton(transaction: Transaction) { + actionButton.setOnClickListener { listener.onActionButtonClicked(transaction) } + actionButton.visibility = transaction.error?.let { error -> + when (error.code) { + 7025 -> { // KYC + actionButton.setText(R.string.transaction_action_kyc) + VISIBLE + } + else -> GONE + } + } ?: GONE + } + private fun bindAmount(transaction: Transaction) { val amountStr = transaction.amountEffective.amountStr when (transaction.amountType) { |