From 05aedd6f5378075fb85e852667dbb76fd3a8dc87 Mon Sep 17 00:00:00 2001 From: pokkst <pokkst@protonmail.com> Date: Sat, 17 Sep 2022 14:57:17 -0500 Subject: [PATCH] Add amount to tx details screen --- .../transaction/TransactionFragment.java | 2 ++ .../main/res/layout/fragment_transaction.xml | 28 ++++++++++++++++++- app/src/main/res/values/strings.xml | 2 ++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/m2049r/xmrwallet/fragment/transaction/TransactionFragment.java b/app/src/main/java/com/m2049r/xmrwallet/fragment/transaction/TransactionFragment.java index 1ec536f..6f1839f 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/fragment/transaction/TransactionFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/fragment/transaction/TransactionFragment.java @@ -94,11 +94,13 @@ public class TransactionFragment extends Fragment { TextView txAddressTextView = view.findViewById(R.id.transaction_address_textview); ImageButton copyTxAddressImageButton = view.findViewById(R.id.copy_txaddress_imagebutton); TextView txDateTextView = view.findViewById(R.id.transaction_date_textview); + TextView txAmountTextView = view.findViewById(R.id.transaction_amount_textview); mViewModel.transaction.observe(getViewLifecycleOwner(), transactionInfo -> { txHashTextView.setText(transactionInfo.hash); txConfTextView.setText(""+transactionInfo.confirmations); txDateTextView.setText(getDateTime(transactionInfo.timestamp)); + txAmountTextView.setText(getResources().getString(R.string.tx_amount_no_prefix, Helper.getDisplayAmount(transactionInfo.amount))); }); mViewModel.destination.observe(getViewLifecycleOwner(), s -> { diff --git a/app/src/main/res/layout/fragment_transaction.xml b/app/src/main/res/layout/fragment_transaction.xml index 847592f..deafa3f 100644 --- a/app/src/main/res/layout/fragment_transaction.xml +++ b/app/src/main/res/layout/fragment_transaction.xml @@ -86,6 +86,32 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@id/transaction_conf_label_textview"/> + <TextView + android:id="@+id/transaction_amount_label_textview" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/amount_label" + android:textSize="18sp" + android:layout_marginTop="16dp" + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@id/transaction_conf_textview"/> + + <TextView + android:id="@+id/transaction_amount_textview" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:text="@string/tx_amount_no_prefix" + android:textSize="14sp" + android:layout_marginTop="8dp" + android:textStyle="bold" + android:singleLine="true" + android:ellipsize="middle" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@id/transaction_amount_label_textview"/> + <TextView android:id="@+id/transaction_address_label_textview" android:layout_width="match_parent" @@ -96,7 +122,7 @@ android:textStyle="bold" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toBottomOf="@id/transaction_conf_textview"/> + app:layout_constraintTop_toBottomOf="@id/transaction_amount_textview"/> <TextView android:id="@+id/transaction_address_textview" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e43af4d..c68d83d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -81,6 +81,8 @@ <string name="node_name_hint">My Monero Node</string> <string name="node_address_hint">127.0.0.1:18081</string> <string name="transaction">Transaction</string> + <string name="amount_label">Amount</string> + <string name="tx_amount_no_prefix">%1$s XMR</string> <string name="wallet_proxy_address_hint">127.0.0.1</string> <string name="wallet_proxy_port_hint">9050</string>