Add block height to tx details view

This commit is contained in:
pokkst 2022-10-13 19:28:36 -05:00
parent 1b4008cc65
commit 119ccd67bb
No known key found for this signature in database
GPG Key ID: 90C2ED85E67A50FF
3 changed files with 38 additions and 1 deletions

View File

@ -80,12 +80,22 @@ public class TransactionFragment extends Fragment {
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);
TextView blockHeightTextView = view.findViewById(R.id.tx_block_height_textview);
TextView blockHeightLabelTextView = view.findViewById(R.id.transaction_block_height_label_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)));
if(transactionInfo.confirmations > 0) {
blockHeightTextView.setText("" + transactionInfo.blockheight);
blockHeightTextView.setVisibility(View.VISIBLE);
blockHeightLabelTextView.setVisibility(View.VISIBLE);
} else {
blockHeightTextView.setVisibility(View.GONE);
blockHeightLabelTextView.setVisibility(View.GONE);
}
});
mViewModel.destination.observe(getViewLifecycleOwner(), s -> {

View File

@ -86,6 +86,32 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/transaction_conf_label_textview"/>
<TextView
android:id="@+id/transaction_block_height_label_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/block_height"
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/tx_block_height_textview"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="0"
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_block_height_label_textview"/>
<TextView
android:id="@+id/transaction_amount_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/tx_block_height_textview"/>
<TextView
android:id="@+id/transaction_amount_textview"

View File

@ -111,4 +111,5 @@
<string name="wallet_viewkey_label">Private view-key</string>
<string name="wallet_viewkey_desc">Anyone with your private view-key can see all incoming transactions!</string>
<string name="wallet_restore_height_label">Restore height</string>
<string name="block_height">Block Height</string>
</resources>