From ae232d1a92fe45c2e93fc9b3205e69fd9deedf99 Mon Sep 17 00:00:00 2001 From: pokkst Date: Wed, 7 Sep 2022 17:46:53 -0500 Subject: [PATCH] Display tx info NOTE: This commit still logs seed phrases for development purposes --- .../adapter/TransactionInfoAdapter.java | 93 +++++++++++++++++++ .../service/MoneroHandlerThread.java | 4 +- .../res/layout/transaction_history_item.xml | 8 -- 3 files changed, 96 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/m2049r/xmrwallet/adapter/TransactionInfoAdapter.java b/app/src/main/java/com/m2049r/xmrwallet/adapter/TransactionInfoAdapter.java index 343aaa3..1a383c3 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/adapter/TransactionInfoAdapter.java +++ b/app/src/main/java/com/m2049r/xmrwallet/adapter/TransactionInfoAdapter.java @@ -16,6 +16,8 @@ package com.m2049r.xmrwallet.adapter; +import static com.m2049r.xmrwallet.util.DateHelper.DATETIME_FORMATTER; + import android.content.Context; import android.text.Html; import android.text.Spanned; @@ -36,6 +38,7 @@ import com.m2049r.xmrwallet.R; import com.m2049r.xmrwallet.data.Crypto; import com.m2049r.xmrwallet.data.UserNotes; import com.m2049r.xmrwallet.model.TransactionInfo; +import com.m2049r.xmrwallet.model.Wallet; import com.m2049r.xmrwallet.util.Helper; import com.m2049r.xmrwallet.util.ThemeHelper; @@ -60,17 +63,107 @@ public class TransactionInfoAdapter extends RecyclerView.Adapter { listener.onClickTransaction(txInfo); }); } + + private void setTxColour(int clr) { + amountTextView.setTextColor(clr); + } + + private String getDateTime(long time) { + return DATETIME_FORMATTER.format(new Date(time * 1000)); + } } /** diff --git a/app/src/main/java/com/m2049r/xmrwallet/service/MoneroHandlerThread.java b/app/src/main/java/com/m2049r/xmrwallet/service/MoneroHandlerThread.java index a7e8469..afd7f7a 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/service/MoneroHandlerThread.java +++ b/app/src/main/java/com/m2049r/xmrwallet/service/MoneroHandlerThread.java @@ -17,6 +17,8 @@ package com.m2049r.xmrwallet.service; +import static com.m2049r.xmrwallet.model.Wallet.SWEEP_ALL; + import com.m2049r.xmrwallet.data.DefaultNodes; import com.m2049r.xmrwallet.data.Node; import com.m2049r.xmrwallet.data.TxData; @@ -97,7 +99,7 @@ public class MoneroHandlerThread extends Thread implements WalletListener { public boolean sendTx(String address, String amountStr) { long amount = Wallet.getAmountFromString(amountStr); - PendingTransaction pendingTx = wallet.createTransaction(new TxData(address, amount, 0, PendingTransaction.Priority.Priority_Default)); + PendingTransaction pendingTx = wallet.createTransaction(new TxData(address, SWEEP_ALL, 0, PendingTransaction.Priority.Priority_Default)); return pendingTx.commit("", true); } diff --git a/app/src/main/res/layout/transaction_history_item.xml b/app/src/main/res/layout/transaction_history_item.xml index 9edf678..2d5c99c 100644 --- a/app/src/main/res/layout/transaction_history_item.xml +++ b/app/src/main/res/layout/transaction_history_item.xml @@ -28,14 +28,6 @@ android:layout_height="wrap_content" android:layout_gravity="center"> - -