From a20adabb2cfbaa2a78acac6560d81c27ca721731 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Thu, 6 Aug 2020 09:41:16 -0300 Subject: [wallet] show error icon for transactions with error --- .../main/java/net/taler/wallet/transactions/TransactionAdapter.kt | 7 +++++-- wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt | 7 +++++-- wallet/src/main/res/drawable/ic_error.xml | 1 + wallet/src/main/res/drawable/transaction_refresh.xml | 1 + wallet/src/main/res/drawable/transaction_refund.xml | 1 + wallet/src/main/res/drawable/transaction_tip_accepted.xml | 1 + wallet/src/main/res/drawable/transaction_withdrawal.xml | 1 + wallet/src/main/res/layout/list_item_transaction.xml | 1 - 8 files changed, 15 insertions(+), 5 deletions(-) (limited to 'wallet/src') 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 d670b74..f494b05 100644 --- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt +++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt @@ -89,8 +89,11 @@ internal class TransactionAdapter( v.foreground = selectableForeground v.setOnClickListener { listener.onTransactionClicked(transaction) } v.isActivated = selected - - icon.setImageResource(transaction.icon) + if (transaction.error == null) { + icon.setImageResource(transaction.icon) + } else { + icon.setImageResource(R.drawable.ic_error) + } title.text = transaction.getTitle(context) bindExtraInfo(transaction) time.text = transaction.timestamp.ms.toRelativeTime(context) 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 1dc55dc..5363834 100644 --- a/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt +++ b/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt @@ -72,8 +72,11 @@ sealed class AmountType { object Neutral : AmountType() } -class TransactionError(private val ec: Int, private val hint: String?) { - val text get() = if (hint == null) "$ec" else "$ec - $hint" +data class TransactionError( + private val ec: Int, + private val hint: String? +) { + val text get() = if (hint == null) "$ec" else "$ec $hint" } @JsonTypeName("withdrawal") diff --git a/wallet/src/main/res/drawable/ic_error.xml b/wallet/src/main/res/drawable/ic_error.xml index abbe33e..4f747f1 100644 --- a/wallet/src/main/res/drawable/ic_error.xml +++ b/wallet/src/main/res/drawable/ic_error.xml @@ -17,6 +17,7 @@ -- cgit v1.2.3