Skip to content

Commit

Permalink
Add block height to tx details view
Browse files Browse the repository at this point in the history
  • Loading branch information
pokkst committed Oct 14, 2022
1 parent 1b4008c commit 119ccd6
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,22 @@ private void bindObservers(View view) {
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 -> {
Expand Down
28 changes: 27 additions & 1 deletion app/src/main/res/layout/fragment_transaction.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

0 comments on commit 119ccd6

Please sign in to comment.