diff options
author | Torsten Grote <t@grobox.de> | 2020-05-14 11:01:07 -0300 |
---|---|---|
committer | Torsten Grote <t@grobox.de> | 2020-05-15 14:26:42 -0300 |
commit | 171a1ae228b801d5c0d54c6c7e7ad8aa458d6bce (patch) | |
tree | 765016dc7b6bc9d3c10fe69ec50f52b9e94b3366 /wallet/src/main/java/net/taler/wallet/history/DevHistoryAdapter.kt | |
parent | bedd7b05eb0b5ee69cd5f35b283e713cf8af29dc (diff) | |
download | taler-android-171a1ae228b801d5c0d54c6c7e7ad8aa458d6bce.tar.gz taler-android-171a1ae228b801d5c0d54c6c7e7ad8aa458d6bce.tar.bz2 taler-android-171a1ae228b801d5c0d54c6c7e7ad8aa458d6bce.zip |
[wallet] clean up old history code that not needed anymore
The history is now only for debugging visible in dev mode,
so it is sufficient to show JSON and not parse all its fields.
Diffstat (limited to 'wallet/src/main/java/net/taler/wallet/history/DevHistoryAdapter.kt')
-rw-r--r-- | wallet/src/main/java/net/taler/wallet/history/DevHistoryAdapter.kt | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/history/DevHistoryAdapter.kt b/wallet/src/main/java/net/taler/wallet/history/DevHistoryAdapter.kt index 88db90c..a2684e1 100644 --- a/wallet/src/main/java/net/taler/wallet/history/DevHistoryAdapter.kt +++ b/wallet/src/main/java/net/taler/wallet/history/DevHistoryAdapter.kt @@ -30,13 +30,14 @@ import net.taler.common.exhaustive import net.taler.common.toRelativeTime import net.taler.wallet.R import net.taler.wallet.history.DevHistoryAdapter.HistoryViewHolder +import net.taler.wallet.transactions.AmountType -@Deprecated("Replaced by TransactionAdapter") internal class DevHistoryAdapter( - private val listener: OnEventClickListener, - private var history: History = History() + private val listener: OnEventClickListener ) : Adapter<HistoryViewHolder>() { + private var history: List<HistoryEvent> = ArrayList() + init { setHasStableIds(false) } @@ -54,7 +55,7 @@ internal class DevHistoryAdapter( holder.bind(transaction) } - fun update(updatedHistory: History) { + fun update(updatedHistory: List<HistoryEvent>) { this.history = updatedHistory this.notifyDataSetChanged() } @@ -73,19 +74,7 @@ internal class DevHistoryAdapter( open fun bind(historyEvent: HistoryEvent) { v.setOnClickListener { listener.onTransactionClicked(historyEvent) } icon.setImageResource(historyEvent.icon) - - title.text = if (historyEvent.title == null) { - when (historyEvent) { - is RefreshHistoryEvent -> getRefreshTitle(historyEvent) - is OrderAcceptedHistoryEvent -> context.getString(R.string.transaction_order_accepted) - is OrderRefusedHistoryEvent -> context.getString(R.string.transaction_order_refused) - is TipAcceptedHistoryEvent -> context.getString(R.string.transaction_tip_accepted) - is TipDeclinedHistoryEvent -> context.getString(R.string.transaction_tip_declined) - is ReserveBalanceUpdatedHistoryEvent -> context.getString(R.string.transaction_reserve_balance_updated) - else -> historyEvent::class.java.simpleName - } - } else historyEvent.title - + title.text = historyEvent.title time.text = historyEvent.timestamp.ms.toRelativeTime(context) bindAmount(historyEvent.displayAmount) } @@ -116,18 +105,6 @@ internal class DevHistoryAdapter( } } - private fun getRefreshTitle(transaction: RefreshHistoryEvent): String { - val res = when (transaction.refreshReason) { - RefreshReason.MANUAL -> R.string.transaction_refresh_reason_manual - RefreshReason.PAY -> R.string.transaction_refresh_reason_pay - RefreshReason.REFUND -> R.string.transaction_refresh_reason_refund - RefreshReason.ABORT_PAY -> R.string.transaction_refresh_reason_abort_pay - RefreshReason.RECOUP -> R.string.transaction_refresh_reason_recoup - RefreshReason.BACKUP_RESTORED -> R.string.transaction_refresh_reason_backup_restored - } - return context.getString(R.string.transaction_refresh) + " " + context.getString(res) - } - } } |