summaryrefslogtreecommitdiff
path: root/wallet/src/main/java/net
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2020-05-15 13:47:40 -0300
committerTorsten Grote <t@grobox.de>2020-05-15 14:26:44 -0300
commit40ccf513c42736ff463a4815a24466d3b28e33a9 (patch)
tree96ac293fa037a970729b2842ce3d685c7ddac0b8 /wallet/src/main/java/net
parent290b062b8fe121869381b2c59fd7b85ace21457d (diff)
downloadtaler-android-dev/torsten-grote/transactions.tar.gz
taler-android-dev/torsten-grote/transactions.tar.bz2
taler-android-dev/torsten-grote/transactions.zip
[wallet] show generic transaction titles in detail action bardev/torsten-grote/transactions
Diffstat (limited to 'wallet/src/main/java/net')
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt2
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt9
2 files changed, 10 insertions, 1 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt
index fdb074d..6b58824 100644
--- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt
@@ -63,7 +63,7 @@ class TransactionDetailFragment : Fragment() {
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
requireActivity().apply {
- title = transaction.getTitle(this)
+ title = getString(transaction.generalTitleRes)
}
}
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 c3a0c08..6dc9af1 100644
--- a/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt
@@ -19,6 +19,7 @@ package net.taler.wallet.transactions
import android.content.Context
import androidx.annotation.DrawableRes
import androidx.annotation.LayoutRes
+import androidx.annotation.StringRes
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.annotation.JsonSubTypes
import com.fasterxml.jackson.annotation.JsonSubTypes.Type
@@ -57,6 +58,9 @@ abstract class Transaction(
abstract val amountType: AmountType
abstract fun getTitle(context: Context): String
+
+ @get:StringRes
+ abstract val generalTitleRes: Int
}
sealed class AmountType {
@@ -80,6 +84,7 @@ class TransactionWithdrawal(
override val detailPageLayout = R.layout.fragment_transaction_withdrawal
override val amountType = AmountType.Positive
override fun getTitle(context: Context) = cleanExchange(exchangeBaseUrl)
+ override val generalTitleRes = R.string.withdraw_title
}
@JsonTypeName("payment")
@@ -96,6 +101,7 @@ class TransactionPayment(
override val detailPageLayout = R.layout.fragment_transaction_payment
override val amountType = AmountType.Negative
override fun getTitle(context: Context) = info.merchant.name ?: info.summary
+ override val generalTitleRes = R.string.payment_title
}
class TransactionInfo(
@@ -143,6 +149,7 @@ class TransactionRefund(
context.getString(R.string.transaction_refund_from, info.merchant.name)
}
}
+ override val generalTitleRes = R.string.refund_title
}
@JsonTypeName("tip")
@@ -162,6 +169,7 @@ class TransactionTip(
override fun getTitle(context: Context): String {
return context.getString(R.string.transaction_tip_from, merchant.name)
}
+ override val generalTitleRes = R.string.tip_title
}
@JsonTypeName("refresh")
@@ -179,4 +187,5 @@ class TransactionRefresh(
override fun getTitle(context: Context): String {
return context.getString(R.string.transaction_refresh)
}
+ override val generalTitleRes = R.string.transaction_refresh
}