gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-android] 01/08: [wallet] More logical order of amounts


From: gnunet
Subject: [taler-taler-android] 01/08: [wallet] More logical order of amounts
Date: Wed, 06 Mar 2024 18:38:03 +0100

This is an automated email from the git hooks/post-receive script.

torsten-grote pushed a commit to branch master
in repository taler-android.

commit 81853300771c80c12d28df51388aa6b2d5eeb0d4
Author: Iván Ávalos <avalos@disroot.org>
AuthorDate: Wed Feb 28 13:24:51 2024 -0600

        [wallet] More logical order of amounts
    
        bug 0008542
---
 .../taler/wallet/deposit/MakeDepositComposable.kt  | 10 +---
 .../wallet/deposit/TransactionDepositComposable.kt | 16 +++--
 .../wallet/payment/TransactionPaymentComposable.kt | 16 +++--
 .../taler/wallet/peer/TransactionPeerPullCredit.kt | 14 ++---
 .../taler/wallet/peer/TransactionPeerPullDebit.kt  | 13 ++--
 .../taler/wallet/peer/TransactionPeerPushCredit.kt | 13 ++--
 .../taler/wallet/peer/TransactionPeerPushDebit.kt  | 12 ++--
 .../main/res/layout/fragment_prompt_withdraw.xml   | 70 +++++++++++-----------
 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
@@ -39,16 +39,12 @@ 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
@@ -39,16 +39,12 @@ 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
@@ -58,12 +58,6 @@ fun ColumnScope.TransactionPeerPushDebitComposable(t: 
TransactionPeerPushDebit)
         talerUri = t.talerUri,
     )
 
-    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,
@@ -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

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]