diff options
Diffstat (limited to 'wallet/src/main')
5 files changed, 17 insertions, 4 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 } diff --git a/wallet/src/main/res/layout/list_item_history.xml b/wallet/src/main/res/layout/list_item_history.xml index 2fabe1d..bc94738 100644 --- a/wallet/src/main/res/layout/list_item_history.xml +++ b/wallet/src/main/res/layout/list_item_history.xml @@ -47,7 +47,7 @@ app:layout_constraintEnd_toStartOf="@+id/amount" app:layout_constraintStart_toEndOf="@+id/icon" app:layout_constraintTop_toTopOf="parent" - tools:text="@string/transaction_payment" /> + tools:text="@string/payment_title" /> <TextView android:id="@+id/amount" diff --git a/wallet/src/main/res/layout/list_item_transaction.xml b/wallet/src/main/res/layout/list_item_transaction.xml index a35ac30..34712a2 100644 --- a/wallet/src/main/res/layout/list_item_transaction.xml +++ b/wallet/src/main/res/layout/list_item_transaction.xml @@ -47,7 +47,7 @@ app:layout_constraintEnd_toStartOf="@+id/barrier" app:layout_constraintStart_toEndOf="@+id/icon" app:layout_constraintTop_toTopOf="parent" - tools:text="@string/transaction_payment" /> + tools:text="@string/payment_title" /> <TextView android:id="@+id/extraInfoView" diff --git a/wallet/src/main/res/values/strings.xml b/wallet/src/main/res/values/strings.xml index 828e7b3..cddc1d5 100644 --- a/wallet/src/main/res/values/strings.xml +++ b/wallet/src/main/res/values/strings.xml @@ -68,7 +68,6 @@ GNU Taler is immune against many types of fraud, such as phishing of credit card <string name="transactions_select_all">Select All</string> <!-- Transactions --> - <string name="transaction_payment">Payment</string> <string name="transaction_paid">Paid</string> <string name="transaction_order_total">Total</string> <string name="transaction_order">Purchase</string> @@ -80,6 +79,7 @@ GNU Taler is immune against many types of fraud, such as phishing of credit card <string name="transaction_pending">PENDING</string> <string name="transaction_refresh">Coin expiry change fee</string> + <string name="payment_title">Payment</string> <string name="payment_fee">+%s payment fee</string> <string name="payment_button_confirm">Confirm Payment</string> <string name="payment_label_amount_total">Total Amount:</string> @@ -93,6 +93,7 @@ GNU Taler is immune against many types of fraud, such as phishing of credit card <string name="payment_already_paid">You\'ve already paid for this purchase.</string> <string name="withdraw_initiated">Withdrawal initiated</string> + <string name="withdraw_title">Withdrawal</string> <string name="withdraw_total">Withdraw</string> <string name="withdraw_fees">Fee</string> <string name="withdraw_exchange">Exchange</string> @@ -138,7 +139,10 @@ GNU Taler is immune against many types of fraud, such as phishing of credit card <string name="settings_reset">Reset Wallet (dangerous!)</string> <string name="settings_reset_summary">Throws away your money</string> + <string name="refund_title">Refund</string> <string name="refund_error">Error processing refund</string> <string name="refund_success">Refund received</string> + <string name="tip_title">Tip</string> + </resources> |