diff options
author | Iván Ávalos <avalos@disroot.org> | 2024-02-28 13:24:51 -0600 |
---|---|---|
committer | Torsten Grote <t@grobox.de> | 2024-03-06 14:18:54 -0300 |
commit | 81853300771c80c12d28df51388aa6b2d5eeb0d4 (patch) | |
tree | acaadf69e726a17557fdea26cc9bed6e163baf9c /wallet/src | |
parent | b490d9421ab22c23d17e6a06384f3e59248254ba (diff) | |
download | taler-android-81853300771c80c12d28df51388aa6b2d5eeb0d4.tar.gz taler-android-81853300771c80c12d28df51388aa6b2d5eeb0d4.tar.bz2 taler-android-81853300771c80c12d28df51388aa6b2d5eeb0d4.zip |
[wallet] More logical order of amounts
bug 0008542
Diffstat (limited to 'wallet/src')
8 files changed, 89 insertions, 75 deletions
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 2fc4d55..97e2eb0 100644 --- a/wallet/src/main/java/net/taler/wallet/deposit/MakeDepositComposable.kt +++ b/wallet/src/main/java/net/taler/wallet/deposit/MakeDepositComposable.kt @@ -123,12 +123,8 @@ fun MakeDepositComposable( } ) TransactionAmountComposable( - label = if (state.effectiveDepositAmount == null) { - stringResource(R.string.amount_chosen) - } else { - stringResource(R.string.send_deposit_amount_effective) - }, - amount = state.effectiveDepositAmount ?: amount, + label = stringResource(R.string.amount_chosen), + amount = amount, amountType = Positive, ) AnimatedVisibility(visible = state.showFees) { @@ -148,7 +144,7 @@ fun MakeDepositComposable( TransactionAmountComposable( label = stringResource(R.string.send_amount), - amount = totalAmount, + amount = effectiveAmount, amountType = Positive, ) } 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 1d5c91e..026ab05 100644 --- a/wallet/src/main/java/net/taler/wallet/deposit/TransactionDepositComposable.kt +++ b/wallet/src/main/java/net/taler/wallet/deposit/TransactionDepositComposable.kt @@ -68,16 +68,13 @@ fun TransactionDepositComposable( text = t.timestamp.ms.toAbsoluteTime(context).toString(), style = MaterialTheme.typography.bodyLarge, ) + TransactionAmountComposable( - label = stringResource(id = R.string.transaction_paid), - amount = t.amountEffective, - amountType = AmountType.Negative, - ) - TransactionAmountComposable( - label = stringResource(id = R.string.transaction_order_total), + label = stringResource(id = R.string.amount_chosen), amount = t.amountRaw, amountType = AmountType.Neutral, ) + val fee = t.amountEffective - t.amountRaw if (!fee.isZero()) { TransactionAmountComposable( @@ -86,6 +83,13 @@ fun TransactionDepositComposable( amountType = AmountType.Negative, ) } + + TransactionAmountComposable( + label = stringResource(id = R.string.send_peer_payment_amount_sent), + amount = t.amountEffective, + amountType = AmountType.Negative, + ) + TransitionsComposable(t, devMode, onTransition) if (devMode && t.error != null) { ErrorTransactionButton(error = t.error) 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 7de16b6..5bbbd97 100644 --- a/wallet/src/main/java/net/taler/wallet/payment/TransactionPaymentComposable.kt +++ b/wallet/src/main/java/net/taler/wallet/payment/TransactionPaymentComposable.kt @@ -73,16 +73,13 @@ fun TransactionPaymentComposable( text = t.timestamp.ms.toAbsoluteTime(context).toString(), style = MaterialTheme.typography.bodyLarge, ) - TransactionAmountComposable( - label = stringResource(id = R.string.transaction_paid), - amount = t.amountEffective, - amountType = AmountType.Negative, - ) + TransactionAmountComposable( label = stringResource(id = R.string.transaction_order_total), amount = t.amountRaw, amountType = AmountType.Neutral, ) + val fee = t.amountEffective - t.amountRaw if (!fee.isZero()) { TransactionAmountComposable( @@ -91,15 +88,24 @@ fun TransactionPaymentComposable( amountType = AmountType.Negative, ) } + + TransactionAmountComposable( + label = stringResource(id = R.string.transaction_paid), + amount = t.amountEffective, + amountType = AmountType.Negative, + ) + if (t.posConfirmation != null) { TransactionInfoComposable( label = stringResource(id = R.string.payment_confirmation_code), info = t.posConfirmation, ) } + PurchaseDetails(info = t.info) { onFulfill(t.info.fulfillmentUrl ?: "") } + TransitionsComposable(t, devMode, onTransition) if (devMode && t.error != null) { ErrorTransactionButton(error = t.error) 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 de377fc..cc8bfa3 100644 --- a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullCredit.kt +++ b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullCredit.kt @@ -46,13 +46,7 @@ fun ColumnScope.TransactionPeerPullCreditComposable(t: TransactionPeerPullCredit state = t.txState, talerUri = t.talerUri, ) - - TransactionAmountComposable( - label = stringResource(id = R.string.receive_amount), - amount = t.amountEffective, - amountType = AmountType.Positive, - ) - + TransactionAmountComposable( label = stringResource(id = R.string.amount_chosen), amount = t.amountRaw, @@ -68,6 +62,12 @@ fun ColumnScope.TransactionPeerPullCreditComposable(t: TransactionPeerPullCredit ) } + TransactionAmountComposable( + label = stringResource(id = R.string.receive_amount), + amount = t.amountEffective, + amountType = AmountType.Positive, + ) + TransactionInfoComposable( label = stringResource(id = R.string.send_peer_purpose), info = t.info.summary ?: "", 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 aa12a8e..783907e 100644 --- a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullDebit.kt +++ b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullDebit.kt @@ -40,15 +40,11 @@ import net.taler.wallet.transactions.TransactionState @Composable fun TransactionPeerPullDebitComposable(t: TransactionPeerPullDebit) { TransactionAmountComposable( - label = stringResource(id = R.string.transaction_paid), - amount = t.amountEffective, - amountType = AmountType.Negative, - ) - TransactionAmountComposable( label = stringResource(id = R.string.transaction_order_total), amount = t.amountRaw, amountType = AmountType.Neutral, ) + val fee = t.amountEffective - t.amountRaw if (!fee.isZero()) { TransactionAmountComposable( @@ -57,6 +53,13 @@ fun TransactionPeerPullDebitComposable(t: TransactionPeerPullDebit) { amountType = AmountType.Negative, ) } + + TransactionAmountComposable( + label = stringResource(id = R.string.transaction_paid), + amount = t.amountEffective, + amountType = AmountType.Negative, + ) + TransactionInfoComposable( label = stringResource(id = R.string.send_peer_purpose), info = t.info.summary ?: "", 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 2c1c24c..2efa8bb 100644 --- a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushCredit.kt +++ b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushCredit.kt @@ -40,15 +40,11 @@ import net.taler.wallet.transactions.TransactionState @Composable fun TransactionPeerPushCreditComposable(t: TransactionPeerPushCredit) { TransactionAmountComposable( - label = stringResource(id = R.string.send_peer_payment_amount_received), - amount = t.amountEffective, - amountType = AmountType.Positive, - ) - TransactionAmountComposable( label = stringResource(id = R.string.send_peer_payment_amount_sent), amount = t.amountRaw, amountType = AmountType.Neutral, ) + val fee = t.amountRaw - t.amountEffective if (!fee.isZero()) { TransactionAmountComposable( @@ -57,6 +53,13 @@ fun TransactionPeerPushCreditComposable(t: TransactionPeerPushCredit) { amountType = AmountType.Negative, ) } + + TransactionAmountComposable( + label = stringResource(id = R.string.send_peer_payment_amount_received), + amount = t.amountEffective, + amountType = AmountType.Positive, + ) + TransactionInfoComposable( label = stringResource(id = R.string.send_peer_purpose), info = t.info.summary ?: "", 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 d83d8fe..909fd47 100644 --- a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushDebit.kt +++ b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushDebit.kt @@ -59,12 +59,6 @@ fun ColumnScope.TransactionPeerPushDebitComposable(t: TransactionPeerPushDebit) ) TransactionAmountComposable( - label = stringResource(id = R.string.transaction_paid), - amount = t.amountEffective, - amountType = AmountType.Negative, - ) - - TransactionAmountComposable( label = stringResource(id = R.string.transaction_order_total), amount = t.amountRaw, amountType = AmountType.Neutral, @@ -79,6 +73,12 @@ fun ColumnScope.TransactionPeerPushDebitComposable(t: TransactionPeerPushDebit) ) } + TransactionAmountComposable( + label = stringResource(id = R.string.transaction_paid), + amount = t.amountEffective, + amountType = AmountType.Negative, + ) + TransactionInfoComposable( label = stringResource(id = R.string.send_peer_purpose), info = t.info.summary ?: "", diff --git a/wallet/src/main/res/layout/fragment_prompt_withdraw.xml b/wallet/src/main/res/layout/fragment_prompt_withdraw.xml index 748a51a..44d95de 100644 --- a/wallet/src/main/res/layout/fragment_prompt_withdraw.xml +++ b/wallet/src/main/res/layout/fragment_prompt_withdraw.xml @@ -22,106 +22,108 @@ tools:context=".withdraw.PromptWithdrawFragment"> <TextView - android:id="@+id/introView" + android:id="@+id/chosenAmountLabel" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="16dp" + android:layout_marginTop="32dp" android:layout_marginEnd="16dp" - android:layout_marginBottom="8dp" android:gravity="center" - android:text="@string/withdraw_total" + android:text="@string/amount_chosen" android:visibility="invisible" - app:layout_constraintBottom_toTopOf="@+id/effectiveAmountView" + app:layout_constraintBottom_toTopOf="@+id/chosenAmountView" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintHorizontal_bias="0.5" app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/effectiveAmountView" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_chainStyle="packed" tools:visibility="visible" /> <TextView - android:id="@+id/effectiveAmountView" + android:id="@+id/chosenAmountView" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="16dp" + android:layout_marginTop="8dp" android:layout_marginEnd="16dp" android:gravity="center" - android:textColor="@color/green" - android:textSize="24sp" + android:textSize="20sp" android:visibility="invisible" - app:layout_constraintBottom_toTopOf="@+id/chosenAmountLabel" + app:layout_constraintBottom_toTopOf="@+id/feeLabel" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/introView" - tools:text="9.8 TESTKUDOS" + app:layout_constraintTop_toBottomOf="@id/chosenAmountLabel" + tools:text="10 TESTKUDOS" tools:visibility="visible" /> <TextView - android:id="@+id/chosenAmountLabel" + android:id="@+id/feeLabel" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginTop="32dp" android:layout_marginEnd="16dp" android:gravity="center" - android:text="@string/amount_chosen" - android:visibility="invisible" - app:layout_constraintBottom_toTopOf="@+id/chosenAmountView" + android:text="@string/withdraw_fees" + android:visibility="gone" + app:layout_constraintBottom_toTopOf="@+id/feeView" app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.5" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/effectiveAmountView" + app:layout_constraintTop_toBottomOf="@+id/chosenAmountView" tools:visibility="visible" /> <TextView - android:id="@+id/chosenAmountView" + android:id="@+id/feeView" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginTop="8dp" android:layout_marginEnd="16dp" android:gravity="center" + android:textColor="?colorError" android:textSize="20sp" - android:visibility="invisible" - app:layout_constraintBottom_toTopOf="@+id/feeLabel" + android:visibility="gone" + app:layout_constraintBottom_toTopOf="@+id/introView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/chosenAmountLabel" - tools:text="10 TESTKUDOS" + app:layout_constraintTop_toBottomOf="@+id/feeLabel" + tools:text="-0.2 TESTKUDOS" tools:visibility="visible" /> <TextView - android:id="@+id/feeLabel" + android:id="@+id/introView" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginTop="32dp" android:layout_marginEnd="16dp" + android:layout_marginBottom="8dp" android:gravity="center" - android:text="@string/withdraw_fees" - android:visibility="gone" - app:layout_constraintBottom_toTopOf="@+id/feeView" + android:text="@string/withdraw_total" + android:visibility="invisible" + app:layout_constraintBottom_toTopOf="@+id/effectiveAmountView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.5" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/chosenAmountView" + app:layout_constraintTop_toBottomOf="@id/feeView" tools:visibility="visible" /> <TextView - android:id="@+id/feeView" + android:id="@+id/effectiveAmountView" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="16dp" - android:layout_marginTop="8dp" android:layout_marginEnd="16dp" android:gravity="center" - android:textColor="?colorError" - android:textSize="20sp" - android:visibility="gone" + android:textColor="@color/green" + android:textSize="24sp" + android:visibility="invisible" app:layout_constraintBottom_toTopOf="@+id/exchangeIntroView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/feeLabel" - tools:text="-0.2 TESTKUDOS" + app:layout_constraintTop_toBottomOf="@+id/introView" + tools:text="9.8 TESTKUDOS" tools:visibility="visible" /> <TextView @@ -139,7 +141,7 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.5" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/feeView" + app:layout_constraintTop_toBottomOf="@+id/effectiveAmountView" tools:visibility="visible" /> <TextView |