summaryrefslogtreecommitdiff
path: root/wallet/src/main/java/net
diff options
context:
space:
mode:
Diffstat (limited to 'wallet/src/main/java/net')
-rw-r--r--wallet/src/main/java/net/taler/wallet/ReceiveFundsFragment.kt4
-rw-r--r--wallet/src/main/java/net/taler/wallet/SendFundsFragment.kt4
-rw-r--r--wallet/src/main/java/net/taler/wallet/balances/BalanceAdapter.kt17
-rw-r--r--wallet/src/main/java/net/taler/wallet/deposit/MakeBitcoinDepositComposable.kt18
-rw-r--r--wallet/src/main/java/net/taler/wallet/deposit/MakeDepositComposable.kt16
-rw-r--r--wallet/src/main/java/net/taler/wallet/deposit/PayToUriFragment.kt4
-rw-r--r--wallet/src/main/java/net/taler/wallet/deposit/TransactionDepositComposable.kt6
-rw-r--r--wallet/src/main/java/net/taler/wallet/payment/PayTemplateComposable.kt8
-rw-r--r--wallet/src/main/java/net/taler/wallet/payment/PayTemplateOrderComposable.kt4
-rw-r--r--wallet/src/main/java/net/taler/wallet/payment/TransactionPaymentComposable.kt6
-rw-r--r--wallet/src/main/java/net/taler/wallet/peer/IncomingComposable.kt32
-rw-r--r--wallet/src/main/java/net/taler/wallet/peer/OutgoingPullComposable.kt6
-rw-r--r--wallet/src/main/java/net/taler/wallet/peer/OutgoingPushComposable.kt2
-rw-r--r--wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullCredit.kt8
-rw-r--r--wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullDebit.kt6
-rw-r--r--wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushCredit.kt6
-rw-r--r--wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushDebit.kt6
-rw-r--r--wallet/src/main/java/net/taler/wallet/refund/TransactionRefundComposable.kt6
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/TransactionLossFragment.kt2
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/TransactionRefreshFragment.kt2
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt11
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt16
-rw-r--r--wallet/src/main/java/net/taler/wallet/withdraw/PromptWithdrawFragment.kt4
-rw-r--r--wallet/src/main/java/net/taler/wallet/withdraw/TransactionWithdrawalComposable.kt20
-rw-r--r--wallet/src/main/java/net/taler/wallet/withdraw/manual/ScreenTransfer.kt22
-rw-r--r--wallet/src/main/java/net/taler/wallet/withdraw/manual/TransferIBAN.kt2
-rw-r--r--wallet/src/main/java/net/taler/wallet/withdraw/manual/TransferTaler.kt2
27 files changed, 133 insertions, 107 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/ReceiveFundsFragment.kt b/wallet/src/main/java/net/taler/wallet/ReceiveFundsFragment.kt
index 2accaaf..25d35ec 100644
--- a/wallet/src/main/java/net/taler/wallet/ReceiveFundsFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/ReceiveFundsFragment.kt
@@ -144,9 +144,9 @@ private fun ReceiveFundsIntro(
isError = false
text = input
},
- label = { Text(stringResource(R.string.receive_amount)) },
+ label = { Text(stringResource(R.string.amount_receive)) },
supportingText = {
- if (isError) Text(stringResource(R.string.receive_amount_invalid))
+ if (isError) Text(stringResource(R.string.amount_invalid))
},
isError = isError,
numberOfDecimals = spec?.numFractionalInputDigits ?: DEFAULT_INPUT_DECIMALS,
diff --git a/wallet/src/main/java/net/taler/wallet/SendFundsFragment.kt b/wallet/src/main/java/net/taler/wallet/SendFundsFragment.kt
index 2581979..ca72a64 100644
--- a/wallet/src/main/java/net/taler/wallet/SendFundsFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/SendFundsFragment.kt
@@ -126,9 +126,9 @@ private fun SendFundsIntro(
insufficientBalance = false
text = input
},
- label = { Text(stringResource(R.string.send_amount)) },
+ label = { Text(stringResource(R.string.amount_send)) },
supportingText = {
- if (isError) Text(stringResource(R.string.receive_amount_invalid))
+ if (isError) Text(stringResource(R.string.amount_invalid))
else if (insufficientBalance) {
Text(stringResource(R.string.payment_balance_insufficient))
}
diff --git a/wallet/src/main/java/net/taler/wallet/balances/BalanceAdapter.kt b/wallet/src/main/java/net/taler/wallet/balances/BalanceAdapter.kt
index f40def4..aabef4b 100644
--- a/wallet/src/main/java/net/taler/wallet/balances/BalanceAdapter.kt
+++ b/wallet/src/main/java/net/taler/wallet/balances/BalanceAdapter.kt
@@ -61,8 +61,7 @@ class BalanceAdapter(private val listener: BalanceClickListener) : Adapter<Balan
private val amountView: TextView = v.findViewById(R.id.balanceAmountView)
private val scopeView: TextView = v.findViewById(R.id.scopeView)
private val balanceInboundAmount: TextView = v.findViewById(R.id.balanceInboundAmount)
- private val balanceInboundLabel: TextView = v.findViewById(R.id.balanceInboundLabel)
- private val pendingView: TextView = v.findViewById(R.id.pendingView)
+ private val balanceOutboundAmount: TextView = v.findViewById(R.id.balanceOutboundAmount)
fun bind(item: BalanceItem) {
v.setOnClickListener { listener.onBalanceClick(item.scopeInfo) }
@@ -71,11 +70,17 @@ class BalanceAdapter(private val listener: BalanceClickListener) : Adapter<Balan
val amountIncoming = item.pendingIncoming
if (amountIncoming.isZero()) {
balanceInboundAmount.visibility = GONE
- balanceInboundLabel.visibility = GONE
} else {
balanceInboundAmount.visibility = VISIBLE
- balanceInboundLabel.visibility = VISIBLE
- balanceInboundAmount.text = v.context.getString(R.string.amount_positive, amountIncoming.toString(showSymbol = false))
+ balanceInboundAmount.text = v.context.getString(R.string.balances_inbound_amount, amountIncoming.toString(showSymbol = false))
+ }
+
+ val amountOutgoing = item.pendingOutgoing
+ if (amountOutgoing.isZero()) {
+ balanceOutboundAmount.visibility = GONE
+ } else {
+ balanceOutboundAmount.visibility = VISIBLE
+ balanceOutboundAmount.text = v.context.getString(R.string.balances_outbound_amount, amountOutgoing.toString(showSymbol = false))
}
val scopeInfo = item.scopeInfo
@@ -90,8 +95,6 @@ class BalanceAdapter(private val listener: BalanceClickListener) : Adapter<Balan
VISIBLE
}
}
-
- pendingView.visibility = if (item.hasPending) VISIBLE else GONE
}
}
diff --git a/wallet/src/main/java/net/taler/wallet/deposit/MakeBitcoinDepositComposable.kt b/wallet/src/main/java/net/taler/wallet/deposit/MakeBitcoinDepositComposable.kt
index 3fa0d98..d356051 100644
--- a/wallet/src/main/java/net/taler/wallet/deposit/MakeBitcoinDepositComposable.kt
+++ b/wallet/src/main/java/net/taler/wallet/deposit/MakeBitcoinDepositComposable.kt
@@ -91,7 +91,7 @@ fun MakeBitcoinDepositComposable(
}
val amountTitle = if (state.effectiveDepositAmount == null) {
R.string.amount_chosen
- } else R.string.send_deposit_amount_effective
+ } else R.string.amount_effective
TransactionAmountComposable(
label = stringResource(id = amountTitle),
amount = state.effectiveDepositAmount ?: amount,
@@ -104,14 +104,16 @@ fun MakeBitcoinDepositComposable(
) {
val totalAmount = state.totalDepositCost ?: amount
val effectiveAmount = state.effectiveDepositAmount ?: Amount.zero(amount.currency)
- val fee = totalAmount - effectiveAmount
+ if (totalAmount > effectiveAmount) {
+ val fee = totalAmount - effectiveAmount
+ TransactionAmountComposable(
+ label = stringResource(id = R.string.amount_fee),
+ amount = fee,
+ amountType = AmountType.Negative,
+ )
+ }
TransactionAmountComposable(
- label = stringResource(id = R.string.withdraw_fees),
- amount = fee,
- amountType = AmountType.Negative,
- )
- TransactionAmountComposable(
- label = stringResource(id = R.string.send_amount),
+ label = stringResource(id = R.string.amount_send),
amount = totalAmount,
amountType = AmountType.Positive,
)
diff --git a/wallet/src/main/java/net/taler/wallet/deposit/MakeDepositComposable.kt b/wallet/src/main/java/net/taler/wallet/deposit/MakeDepositComposable.kt
index 9333ce1..2f9fd88 100644
--- a/wallet/src/main/java/net/taler/wallet/deposit/MakeDepositComposable.kt
+++ b/wallet/src/main/java/net/taler/wallet/deposit/MakeDepositComposable.kt
@@ -134,16 +134,18 @@ fun MakeDepositComposable(
) {
val totalAmount = state.totalDepositCost ?: amount
val effectiveAmount = state.effectiveDepositAmount ?: Amount.zero(amount.currency)
- val fee = totalAmount - effectiveAmount
+ if (totalAmount > effectiveAmount) {
+ val fee = totalAmount - effectiveAmount
- TransactionAmountComposable(
- label = stringResource(R.string.withdraw_fees),
- amount = fee.withSpec(amount.spec),
- amountType = if (fee.isZero()) Positive else Negative,
- )
+ TransactionAmountComposable(
+ label = stringResource(R.string.amount_fee),
+ amount = fee.withSpec(amount.spec),
+ amountType = Negative,
+ )
+ }
TransactionAmountComposable(
- label = stringResource(R.string.send_amount),
+ label = stringResource(R.string.amount_send),
amount = effectiveAmount.withSpec(amount.spec),
amountType = Positive,
)
diff --git a/wallet/src/main/java/net/taler/wallet/deposit/PayToUriFragment.kt b/wallet/src/main/java/net/taler/wallet/deposit/PayToUriFragment.kt
index 8961016..0dd3abd 100644
--- a/wallet/src/main/java/net/taler/wallet/deposit/PayToUriFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/deposit/PayToUriFragment.kt
@@ -140,7 +140,7 @@ private fun PayToComposable(
amountError = ""
amountText = input
},
- label = { Text(stringResource(R.string.send_amount)) },
+ label = { Text(stringResource(R.string.amount_send)) },
supportingText = {
if (amountError.isNotBlank()) Text(amountError)
},
@@ -158,7 +158,7 @@ private fun PayToComposable(
}
val focusManager = LocalFocusManager.current
- val errorStrInvalidAmount = stringResource(id = R.string.receive_amount_invalid)
+ val errorStrInvalidAmount = stringResource(id = R.string.amount_invalid)
val errorStrInsufficientBalance = stringResource(id = R.string.payment_balance_insufficient)
Button(
modifier = Modifier.padding(16.dp),
diff --git a/wallet/src/main/java/net/taler/wallet/deposit/TransactionDepositComposable.kt b/wallet/src/main/java/net/taler/wallet/deposit/TransactionDepositComposable.kt
index 817dfac..11264a1 100644
--- a/wallet/src/main/java/net/taler/wallet/deposit/TransactionDepositComposable.kt
+++ b/wallet/src/main/java/net/taler/wallet/deposit/TransactionDepositComposable.kt
@@ -77,10 +77,10 @@ fun TransactionDepositComposable(
amountType = AmountType.Neutral,
)
- val fee = t.amountEffective - t.amountRaw
- if (!fee.isZero()) {
+ if (t.amountEffective > t.amountRaw) {
+ val fee = t.amountEffective - t.amountRaw
TransactionAmountComposable(
- label = stringResource(id = R.string.withdraw_fees),
+ label = stringResource(id = R.string.amount_fee),
amount = fee.withSpec(spec),
amountType = AmountType.Negative,
)
diff --git a/wallet/src/main/java/net/taler/wallet/payment/PayTemplateComposable.kt b/wallet/src/main/java/net/taler/wallet/payment/PayTemplateComposable.kt
index 3ea04cc..9107dc9 100644
--- a/wallet/src/main/java/net/taler/wallet/payment/PayTemplateComposable.kt
+++ b/wallet/src/main/java/net/taler/wallet/payment/PayTemplateComposable.kt
@@ -18,6 +18,7 @@ package net.taler.wallet.payment
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -25,6 +26,7 @@ import androidx.compose.ui.Alignment.Companion.Center
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
+import androidx.compose.ui.unit.dp
import net.taler.common.Amount
import net.taler.common.ContractTerms
import net.taler.wallet.AmountResult
@@ -54,7 +56,7 @@ fun PayTemplateComposable(
) {
// If wallet is empty, there's no way the user can pay something
if (amountStatus is AmountFieldStatus.Invalid) {
- PayTemplateError(stringResource(R.string.receive_amount_invalid))
+ PayTemplateError(stringResource(R.string.amount_invalid))
} else if (currencies.isEmpty()) {
PayTemplateError(stringResource(R.string.payment_balance_insufficient))
} else when (val p = payStatus) {
@@ -86,7 +88,7 @@ fun PayTemplateComposable(
@Composable
fun PayTemplateError(message: String) {
Box(
- modifier = Modifier.fillMaxSize(),
+ modifier = Modifier.padding(16.dp).fillMaxSize(),
contentAlignment = Center,
) {
Text(
@@ -144,7 +146,7 @@ fun PayTemplateInsufficientBalancePreview() {
}
}
-@Preview
+@Preview(widthDp = 300)
@Composable
fun PayTemplateAlreadyPaidPreview() {
TalerSurface {
diff --git a/wallet/src/main/java/net/taler/wallet/payment/PayTemplateOrderComposable.kt b/wallet/src/main/java/net/taler/wallet/payment/PayTemplateOrderComposable.kt
index d6131c7..9647c42 100644
--- a/wallet/src/main/java/net/taler/wallet/payment/PayTemplateOrderComposable.kt
+++ b/wallet/src/main/java/net/taler/wallet/payment/PayTemplateOrderComposable.kt
@@ -85,7 +85,7 @@ fun PayTemplateOrderComposable(
onClick = {
when (val res = onCreateAmount(amount, currency)) {
is AmountResult.InsufficientBalance -> onError(R.string.payment_balance_insufficient)
- is AmountResult.InvalidAmount -> onError(R.string.receive_amount_invalid)
+ is AmountResult.InvalidAmount -> onError(R.string.amount_invalid)
is AmountResult.Success -> onSubmit(summary, res.amount)
}
},
@@ -113,7 +113,7 @@ private fun AmountField(
.weight(1f),
value = amount,
onValueChange = { onAmountChosen(it, currency) },
- label = { Text(stringResource(R.string.send_amount)) }
+ label = { Text(stringResource(R.string.amount_send)) }
)
CurrencyDropdown(
modifier = Modifier.weight(1f),
diff --git a/wallet/src/main/java/net/taler/wallet/payment/TransactionPaymentComposable.kt b/wallet/src/main/java/net/taler/wallet/payment/TransactionPaymentComposable.kt
index 0f6d661..beb37d9 100644
--- a/wallet/src/main/java/net/taler/wallet/payment/TransactionPaymentComposable.kt
+++ b/wallet/src/main/java/net/taler/wallet/payment/TransactionPaymentComposable.kt
@@ -82,10 +82,10 @@ fun TransactionPaymentComposable(
amountType = AmountType.Neutral,
)
- val fee = t.amountEffective - t.amountRaw
- if (!fee.isZero()) {
+ if (t.amountEffective > t.amountRaw) {
+ val fee = t.amountEffective - t.amountRaw
TransactionAmountComposable(
- label = stringResource(id = R.string.withdraw_fees),
+ label = stringResource(id = R.string.amount_fee),
amount = fee.withSpec(spec),
amountType = AmountType.Negative,
)
diff --git a/wallet/src/main/java/net/taler/wallet/peer/IncomingComposable.kt b/wallet/src/main/java/net/taler/wallet/peer/IncomingComposable.kt
index 1ce0175..609629e 100644
--- a/wallet/src/main/java/net/taler/wallet/peer/IncomingComposable.kt
+++ b/wallet/src/main/java/net/taler/wallet/peer/IncomingComposable.kt
@@ -134,7 +134,7 @@ fun ColumnScope.PeerPullTermsComposable(
modifier = Modifier.align(End),
) {
Text(
- text = stringResource(id = R.string.payment_label_amount_total),
+ text = stringResource(id = R.string.amount_total_label),
style = MaterialTheme.typography.bodyLarge,
)
Text(
@@ -145,22 +145,26 @@ fun ColumnScope.PeerPullTermsComposable(
)
}
// this gets used for credit and debit, so fee calculation differs
- val fee = if (data.isCredit) {
+ val fee = if (data.isCredit && terms.amountRaw > terms.amountEffective) {
terms.amountRaw - terms.amountEffective
- } else {
+ } else if (terms.amountEffective > terms.amountRaw) {
terms.amountEffective - terms.amountRaw
+ } else null
+
+ if (fee != null) {
+ val feeStr = if (data.isCredit) {
+ stringResource(R.string.amount_negative, fee)
+ } else {
+ stringResource(R.string.amount_positive, fee)
+ }
+ Text(
+ modifier = Modifier.align(End),
+ text = feeStr,
+ style = MaterialTheme.typography.bodyLarge,
+ color = MaterialTheme.colorScheme.error,
+ )
}
- val feeStr = if (data.isCredit) {
- stringResource(R.string.amount_negative, fee)
- } else {
- stringResource(R.string.amount_positive, fee)
- }
- if (!fee.isZero()) Text(
- modifier = Modifier.align(End),
- text = feeStr,
- style = MaterialTheme.typography.bodyLarge,
- color = MaterialTheme.colorScheme.error,
- )
+
if (terms is IncomingAccepting) {
CircularProgressIndicator(
modifier = Modifier
diff --git a/wallet/src/main/java/net/taler/wallet/peer/OutgoingPullComposable.kt b/wallet/src/main/java/net/taler/wallet/peer/OutgoingPullComposable.kt
index 90b520e..f3d569f 100644
--- a/wallet/src/main/java/net/taler/wallet/peer/OutgoingPullComposable.kt
+++ b/wallet/src/main/java/net/taler/wallet/peer/OutgoingPullComposable.kt
@@ -148,10 +148,10 @@ fun OutgoingPullIntroComposable(
amountType = AmountType.Positive,
)
- if (state is OutgoingChecked) {
+ if (state is OutgoingChecked && state.amountRaw > state.amountEffective) {
val fee = state.amountRaw - state.amountEffective
- if (!fee.isZero()) TransactionAmountComposable(
- label = stringResource(id = R.string.withdraw_fees),
+ TransactionAmountComposable(
+ label = stringResource(id = R.string.amount_fee),
amount = fee.withSpec(amount.spec),
amountType = AmountType.Negative,
)
diff --git a/wallet/src/main/java/net/taler/wallet/peer/OutgoingPushComposable.kt b/wallet/src/main/java/net/taler/wallet/peer/OutgoingPushComposable.kt
index d39fdc8..7eba733 100644
--- a/wallet/src/main/java/net/taler/wallet/peer/OutgoingPushComposable.kt
+++ b/wallet/src/main/java/net/taler/wallet/peer/OutgoingPushComposable.kt
@@ -89,7 +89,7 @@ fun OutgoingPushIntroComposable(
style = MaterialTheme.typography.titleLarge,
)
- if (state is OutgoingChecked) {
+ if (state is OutgoingChecked && state.amountEffective > state.amountRaw) {
val fee = state.amountEffective - state.amountRaw
Text(
modifier = Modifier.padding(vertical = 16.dp),
diff --git a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullCredit.kt b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullCredit.kt
index 3b15b6f..59d405c 100644
--- a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullCredit.kt
+++ b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullCredit.kt
@@ -49,15 +49,15 @@ fun ColumnScope.TransactionPeerPullCreditComposable(t: TransactionPeerPullCredit
)
TransactionAmountComposable(
- label = stringResource(id = R.string.receive_peer_amount_invoiced),
+ label = stringResource(id = R.string.amount_invoiced),
amount = t.amountRaw.withSpec(spec),
amountType = AmountType.Neutral,
)
- val fee = t.amountRaw - t.amountEffective
- if (!fee.isZero()) {
+ if (t.amountRaw > t.amountEffective) {
+ val fee = t.amountRaw - t.amountEffective
TransactionAmountComposable(
- label = stringResource(id = R.string.withdraw_fees),
+ label = stringResource(id = R.string.amount_fee),
amount = fee.withSpec(spec),
amountType = AmountType.Negative,
)
diff --git a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullDebit.kt b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullDebit.kt
index dadff4a..b8966d4 100644
--- a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullDebit.kt
+++ b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullDebit.kt
@@ -46,10 +46,10 @@ fun TransactionPeerPullDebitComposable(t: TransactionPeerPullDebit, spec: Curren
amountType = AmountType.Neutral,
)
- val fee = t.amountEffective - t.amountRaw
- if (!fee.isZero()) {
+ if (t.amountEffective > t.amountRaw) {
+ val fee = t.amountEffective - t.amountRaw
TransactionAmountComposable(
- label = stringResource(id = R.string.withdraw_fees),
+ label = stringResource(id = R.string.amount_fee),
amount = fee.withSpec(spec),
amountType = AmountType.Negative,
)
diff --git a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushCredit.kt b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushCredit.kt
index dbf0fb9..d407ff2 100644
--- a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushCredit.kt
+++ b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushCredit.kt
@@ -46,10 +46,10 @@ fun TransactionPeerPushCreditComposable(t: TransactionPeerPushCredit, spec: Curr
amountType = AmountType.Neutral,
)
- val fee = t.amountRaw - t.amountEffective
- if (!fee.isZero()) {
+ if (t.amountRaw > t.amountEffective) {
+ val fee = t.amountRaw - t.amountEffective
TransactionAmountComposable(
- label = stringResource(id = R.string.withdraw_fees),
+ label = stringResource(id = R.string.amount_fee),
amount = fee.withSpec(spec),
amountType = AmountType.Negative,
)
diff --git a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushDebit.kt b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushDebit.kt
index e592c3e..f2edc19 100644
--- a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushDebit.kt
+++ b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushDebit.kt
@@ -65,10 +65,10 @@ fun ColumnScope.TransactionPeerPushDebitComposable(t: TransactionPeerPushDebit,
amountType = AmountType.Neutral,
)
- val fee = t.amountEffective - t.amountRaw
- if (!fee.isZero()) {
+ if (t.amountEffective > t.amountRaw) {
+ val fee = t.amountEffective - t.amountRaw
TransactionAmountComposable(
- label = stringResource(id = R.string.withdraw_fees),
+ label = stringResource(id = R.string.amount_fee),
amount = fee.withSpec(spec),
amountType = AmountType.Negative,
)
diff --git a/wallet/src/main/java/net/taler/wallet/refund/TransactionRefundComposable.kt b/wallet/src/main/java/net/taler/wallet/refund/TransactionRefundComposable.kt
index 637b41a..b17658a 100644
--- a/wallet/src/main/java/net/taler/wallet/refund/TransactionRefundComposable.kt
+++ b/wallet/src/main/java/net/taler/wallet/refund/TransactionRefundComposable.kt
@@ -81,10 +81,10 @@ fun TransactionRefundComposable(
amount = t.amountRaw.withSpec(spec),
amountType = AmountType.Neutral,
)
- val fee = t.amountRaw - t.amountEffective
- if (!fee.isZero()) {
+ if (t.amountRaw > t.amountEffective) {
+ val fee = t.amountRaw - t.amountEffective
TransactionAmountComposable(
- label = stringResource(id = R.string.withdraw_fees),
+ label = stringResource(id = R.string.amount_fee),
amount = fee.withSpec(spec),
amountType = AmountType.Negative,
)
diff --git a/wallet/src/main/java/net/taler/wallet/transactions/TransactionLossFragment.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionLossFragment.kt
index 9138345..2c95880 100644
--- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionLossFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionLossFragment.kt
@@ -99,7 +99,7 @@ fun TransitionLossComposable(
)
TransactionAmountComposable(
- label = stringResource(id = R.string.loss_amount),
+ label = stringResource(id = R.string.amount_lost),
amount = t.amountEffective.withSpec(spec),
amountType = AmountType.Negative,
)
diff --git a/wallet/src/main/java/net/taler/wallet/transactions/TransactionRefreshFragment.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionRefreshFragment.kt
index 8f474f9..e55d887 100644
--- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionRefreshFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionRefreshFragment.kt
@@ -91,7 +91,7 @@ private fun TransactionRefreshComposable(
style = MaterialTheme.typography.bodyLarge,
)
TransactionAmountComposable(
- label = stringResource(id = R.string.withdraw_fees),
+ label = stringResource(id = R.string.amount_fee),
amount = t.amountEffective.withSpec(spec),
amountType = AmountType.Negative,
)
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 7ccdbde..2bd204c 100644
--- a/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt
@@ -17,6 +17,7 @@
package net.taler.wallet.transactions
import android.content.Context
+import android.net.Uri
import android.util.Log
import androidx.annotation.DrawableRes
import androidx.annotation.IdRes
@@ -354,10 +355,7 @@ class TransactionRefund(
@Transient
override val amountType = AmountType.Positive
- override fun getTitle(context: Context): String {
- val merchantName = paymentInfo?.merchant?.name ?: "null"
- return context.getString(R.string.transaction_refund_from, merchantName)
- }
+ override fun getTitle(context: Context) = paymentInfo?.merchant?.name ?: context.getString(R.string.transaction_refund)
override val generalTitleRes = R.string.refund_title
}
@@ -404,7 +402,10 @@ class TransactionDeposit(
@Transient
override val amountType = AmountType.Negative
override fun getTitle(context: Context): String {
- return context.getString(R.string.transaction_deposit)
+ val uri = Uri.parse(targetPaytoUri)
+ return uri.getQueryParameter("receiver-name")?.let { receiverName ->
+ context.getString(R.string.transaction_deposit_to, receiverName)
+ } ?: context.getString(R.string.transaction_deposit)
}
override val generalTitleRes = R.string.transaction_deposit
diff --git a/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt
index 5243427..d2d0c9c 100644
--- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt
@@ -26,6 +26,7 @@ import android.view.MenuItem
import android.view.View
import android.view.View.INVISIBLE
import android.view.ViewGroup
+import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.SearchView
import androidx.appcompat.widget.SearchView.OnQueryTextListener
import androidx.fragment.app.Fragment
@@ -44,6 +45,8 @@ import net.taler.wallet.MainViewModel
import net.taler.wallet.R
import net.taler.wallet.TAG
import net.taler.wallet.balances.BalanceState.Success
+import net.taler.wallet.balances.ScopeInfo
+import net.taler.wallet.cleanExchange
import net.taler.wallet.databinding.FragmentTransactionsBinding
import net.taler.wallet.showError
@@ -115,7 +118,7 @@ class TransactionsFragment : Fragment(), OnTransactionClickListener, ActionMode.
if (balances.size == 1) ui.mainFab.visibility = INVISIBLE
balances.find { it.scopeInfo == scopeInfo }?.let { balance ->
- ui.amount.text = balance.available.toString(showSymbol = false)
+ ui.actionsBar.amount.text = balance.available.toString(showSymbol = false)
transactionAdapter.setCurrencySpec(balance.available.spec)
}
}
@@ -125,10 +128,10 @@ class TransactionsFragment : Fragment(), OnTransactionClickListener, ActionMode.
transactionManager.transactions.observe(viewLifecycleOwner) { result ->
onTransactionsResult(result)
}
- ui.sendButton.setOnClickListener {
+ ui.actionsBar.sendButton.setOnClickListener {
findNavController().navigate(R.id.sendFunds)
}
- ui.receiveButton.setOnClickListener {
+ ui.actionsBar.receiveButton.setOnClickListener {
findNavController().navigate(R.id.action_global_receiveFunds)
}
ui.mainFab.setOnClickListener {
@@ -154,6 +157,8 @@ class TransactionsFragment : Fragment(), OnTransactionClickListener, ActionMode.
override fun onStart() {
super.onStart()
requireActivity().title = getString(R.string.transactions_detail_title_currency, scopeInfo.currency)
+ (requireActivity() as AppCompatActivity).supportActionBar?.subtitle =
+ (scopeInfo as? ScopeInfo.Exchange)?.url?.let { cleanExchange(it) }
}
private fun setupSearch(item: MenuItem) {
@@ -261,6 +266,11 @@ class TransactionsFragment : Fragment(), OnTransactionClickListener, ActionMode.
return true
}
+ override fun onStop() {
+ super.onStop()
+ (requireActivity() as AppCompatActivity).supportActionBar?.subtitle = null
+ }
+
override fun onDestroyActionMode(mode: ActionMode) {
tracker?.clearSelection()
actionMode = null
diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/PromptWithdrawFragment.kt b/wallet/src/main/java/net/taler/wallet/withdraw/PromptWithdrawFragment.kt
index 56f56f7..9983409 100644
--- a/wallet/src/main/java/net/taler/wallet/withdraw/PromptWithdrawFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/withdraw/PromptWithdrawFragment.kt
@@ -175,8 +175,8 @@ class PromptWithdrawFragment : Fragment() {
ui.chosenAmountView.text = amountRaw.toString()
ui.chosenAmountView.fadeIn()
- val fee = amountRaw - amountEffective
- if (!fee.isZero()) {
+ if (amountRaw > amountEffective) {
+ val fee = amountRaw - amountEffective
ui.feeLabel.fadeIn()
ui.feeView.text = getString(R.string.amount_negative, fee.toString())
ui.feeView.fadeIn()
diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/TransactionWithdrawalComposable.kt b/wallet/src/main/java/net/taler/wallet/withdraw/TransactionWithdrawalComposable.kt
index 20f8280..9bfeda6 100644
--- a/wallet/src/main/java/net/taler/wallet/withdraw/TransactionWithdrawalComposable.kt
+++ b/wallet/src/main/java/net/taler/wallet/withdraw/TransactionWithdrawalComposable.kt
@@ -81,23 +81,25 @@ fun TransactionWithdrawalComposable(
ActionButton(tx = t, listener = actionListener)
- TransactionAmountComposable(
- label = stringResource(R.string.amount_chosen),
- amount = t.amountRaw.withSpec(spec),
- amountType = AmountType.Neutral,
- )
+ if (t.amountRaw != t.amountEffective) {
+ TransactionAmountComposable(
+ label = stringResource(R.string.amount_chosen),
+ amount = t.amountRaw.withSpec(spec),
+ amountType = AmountType.Neutral,
+ )
+ }
- val fee = t.amountRaw - t.amountEffective
- if (!fee.isZero()) {
+ if (t.amountRaw > t.amountEffective) {
+ val fee = t.amountRaw - t.amountEffective
TransactionAmountComposable(
- label = stringResource(id = R.string.withdraw_fees),
+ label = stringResource(id = R.string.amount_fee),
amount = fee.withSpec(spec),
amountType = AmountType.Negative,
)
}
TransactionAmountComposable(
- label = stringResource(id = R.string.withdraw_total),
+ label = stringResource(id = R.string.amount_total),
amount = t.amountEffective.withSpec(spec),
amountType = AmountType.Positive,
)
diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/manual/ScreenTransfer.kt b/wallet/src/main/java/net/taler/wallet/withdraw/manual/ScreenTransfer.kt
index 75d03b5..00495fb 100644
--- a/wallet/src/main/java/net/taler/wallet/withdraw/manual/ScreenTransfer.kt
+++ b/wallet/src/main/java/net/taler/wallet/withdraw/manual/ScreenTransfer.kt
@@ -193,33 +193,33 @@ fun WithdrawalAmountTransfer(
horizontalAlignment = Alignment.CenterHorizontally,
) {
TransactionAmountComposable(
- label = stringResource(R.string.withdraw_transfer),
+ label = stringResource(R.string.amount_transfer),
amount = conversionAmountRaw,
amountType = AmountType.Neutral,
)
if (amountRaw.currency != conversionAmountRaw.currency) {
TransactionAmountComposable(
- label = stringResource(R.string.withdraw_conversion),
+ label = stringResource(R.string.amount_conversion),
amount = amountRaw,
amountType = AmountType.Neutral,
)
}
- val fee = amountRaw - amountEffective
- if (!fee.isZero()) {
+ if (amountRaw > amountEffective) {
+ val fee = amountRaw - amountEffective
TransactionAmountComposable(
- label = stringResource(id = R.string.withdraw_fees),
+ label = stringResource(id = R.string.amount_fee),
amount = fee,
amountType = AmountType.Negative,
)
- }
- TransactionAmountComposable(
- label = stringResource(id = R.string.withdraw_total),
- amount = amountEffective,
- amountType = AmountType.Positive,
- )
+ TransactionAmountComposable(
+ label = stringResource(id = R.string.amount_total),
+ amount = amountEffective,
+ amountType = AmountType.Positive,
+ )
+ }
}
}
diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/manual/TransferIBAN.kt b/wallet/src/main/java/net/taler/wallet/withdraw/manual/TransferIBAN.kt
index d0bc893..1698530 100644
--- a/wallet/src/main/java/net/taler/wallet/withdraw/manual/TransferIBAN.kt
+++ b/wallet/src/main/java/net/taler/wallet/withdraw/manual/TransferIBAN.kt
@@ -73,11 +73,11 @@ fun TransferIBAN(
.padding(all = 16.dp)
)
+ DetailRow(stringResource(R.string.withdraw_manual_ready_subject), transfer.subject)
transfer.receiverName?.let {
DetailRow(stringResource(R.string.withdraw_manual_ready_receiver), it)
}
DetailRow(stringResource(R.string.withdraw_manual_ready_iban), transfer.iban)
- DetailRow(stringResource(R.string.withdraw_manual_ready_subject), transfer.subject)
TransactionInfoComposable(
label = stringResource(R.string.withdraw_exchange),
diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/manual/TransferTaler.kt b/wallet/src/main/java/net/taler/wallet/withdraw/manual/TransferTaler.kt
index 2ec43b9..089d0de 100644
--- a/wallet/src/main/java/net/taler/wallet/withdraw/manual/TransferTaler.kt
+++ b/wallet/src/main/java/net/taler/wallet/withdraw/manual/TransferTaler.kt
@@ -73,11 +73,11 @@ fun TransferTaler(
.padding(all = 16.dp)
)
+ DetailRow(stringResource(R.string.withdraw_manual_ready_subject), transfer.subject)
transfer.receiverName?.let {
DetailRow(stringResource(R.string.withdraw_manual_ready_receiver), it)
}
DetailRow(stringResource(R.string.withdraw_manual_ready_account), transfer.account)
- DetailRow(stringResource(R.string.withdraw_manual_ready_subject), transfer.subject)
TransactionInfoComposable(
label = stringResource(R.string.withdraw_exchange),