diff options
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 | 38 |
1 files changed, 15 insertions, 23 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 f93dd66..e6dad6f 100644 --- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt +++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt @@ -104,30 +104,22 @@ internal class TransactionAdapter( } private fun bindAmount(transaction: Transaction) { - val amountEffective = transaction.amountEffective - if (amountEffective == null) { - amount.visibility = GONE - } else { - amount.visibility = VISIBLE - when (transaction.amountType) { - AmountType.Positive -> { - amount.text = - context.getString(R.string.amount_positive, amountEffective.amountStr) - amount.setTextColor(if (transaction.pending) amountColor else green) - } - AmountType.Negative -> { - amount.text = - context.getString(R.string.amount_negative, amountEffective.amountStr) - amount.setTextColor(if (transaction.pending) amountColor else red) - } - AmountType.Neutral -> { - amount.text = amountEffective.amountStr - amount.setTextColor(amountColor) - } - }.exhaustive - } + val amountStr = transaction.amountEffective.amountStr + when (transaction.amountType) { + AmountType.Positive -> { + amount.text = context.getString(R.string.amount_positive, amountStr) + amount.setTextColor(if (transaction.pending) amountColor else green) + } + AmountType.Negative -> { + amount.text = context.getString(R.string.amount_negative, amountStr) + amount.setTextColor(if (transaction.pending) amountColor else red) + } + AmountType.Neutral -> { + amount.text = amountStr + amount.setTextColor(amountColor) + } + }.exhaustive } - } internal inner class TransactionKeyProvider : ItemKeyProvider<String>(SCOPE_MAPPED) { |