diff --git a/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java b/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java index c1e53cd5..35a93981 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java @@ -349,14 +349,14 @@ public class WalletFragment extends Fragment Timber.d("onRefreshed(%b)", full); if (adapter.needsTransactionUpdateOnNewBlock()) { - wallet.getHistory().refresh(); + wallet.refreshHistory(); full = true; } if (full) { List list = new ArrayList<>(); final long streetHeight = activityCallback.getStreetModeHeight(); Timber.d("StreetHeight=%d", streetHeight); - wallet.getHistory().refresh(); + wallet.refreshHistory(); for (TransactionInfo info : wallet.getHistory().getAll()) { Timber.d("TxHeight=%d, Label=%s", info.blockheight, info.subaddressLabel); if ((info.isPending || (info.blockheight >= streetHeight)) diff --git a/app/src/main/java/com/m2049r/xmrwallet/layout/TransactionInfoAdapter.java b/app/src/main/java/com/m2049r/xmrwallet/layout/TransactionInfoAdapter.java index da218804..f7c4f936 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/layout/TransactionInfoAdapter.java +++ b/app/src/main/java/com/m2049r/xmrwallet/layout/TransactionInfoAdapter.java @@ -100,7 +100,7 @@ public class TransactionInfoAdapter extends RecyclerView.Adapter transactions = new ArrayList<>(); - public void refreshWithNotes(Wallet wallet) { + void refreshWithNotes(Wallet wallet) { refresh(); loadNotes(wallet); } -// public void refresh() { -// transactions = refreshJ(); -// } - - public void refresh() { + private void refresh() { List transactionInfos = refreshJ(); - Timber.d("refreshed %d", transactionInfos.size()); + Timber.d("refresh size=%d", transactionInfos.size()); for (Iterator iterator = transactionInfos.iterator(); iterator.hasNext(); ) { TransactionInfo info = iterator.next(); if (info.accountIndex != accountIndex) { iterator.remove(); - Timber.d("removed %s", info.hash); - } else { - Timber.d("kept %s", info.hash); } } transactions = transactionInfos; } private native List refreshJ(); - } diff --git a/app/src/main/java/com/m2049r/xmrwallet/model/Wallet.java b/app/src/main/java/com/m2049r/xmrwallet/model/Wallet.java index 6653418f..47df8e08 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/model/Wallet.java +++ b/app/src/main/java/com/m2049r/xmrwallet/model/Wallet.java @@ -398,6 +398,10 @@ public class Wallet { private native long getHistoryJ(); + public void refreshHistory() { + getHistory().refreshWithNotes(this); + } + //virtual AddressBook * addressBook() const = 0; //virtual void setListener(WalletListener *) = 0; @@ -462,7 +466,7 @@ public class Wallet { public void setSubaddressLabel(int addressIndex, String label) { setSubaddressLabel(accountIndex, addressIndex, label); - getHistory().refreshWithNotes(this); + refreshHistory(); } public native void setSubaddressLabel(int accountIndex, int addressIndex, String label); diff --git a/app/src/main/java/com/m2049r/xmrwallet/service/WalletService.java b/app/src/main/java/com/m2049r/xmrwallet/service/WalletService.java index 876c944c..65bf9ef4 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/service/WalletService.java +++ b/app/src/main/java/com/m2049r/xmrwallet/service/WalletService.java @@ -124,7 +124,7 @@ public class WalletService extends Service { if (!wallet.isSynchronized()) { updated = true; // we want to see our transactions as they come in - wallet.getHistory().refresh(); + wallet.refreshHistory(); int txCount = wallet.getHistory().getCount(); if (txCount > lastTxCount) { // update the transaction list only if we have more than before @@ -152,7 +152,7 @@ public class WalletService extends Service { wallet.setSynchronized(); if (updated) { updateDaemonState(wallet, wallet.getBlockChainHeight()); - wallet.getHistory().refreshWithNotes(wallet); + wallet.refreshHistory(); if (observer != null) { updated = !observer.onRefreshed(wallet, true); }