use of de.schildbach.wallet.addressbook.AddressBookEntry in project bitcoin-wallet by bitcoin-wallet.
the class BlockListFragment method maybeSubmitList.
private void maybeSubmitList() {
final List<StoredBlock> blocks = viewModel.blocks.getValue();
final Wallet wallet = walletActivityViewModel.wallet.getValue();
if (blocks != null) {
final Map<String, AddressBookEntry> addressBook = AddressBookEntry.asMap(viewModel.addressBook.getValue());
adapter.submitList(BlockListAdapter.buildListItems(activity, blocks, viewModel.getTime().getValue(), config.getFormat(), viewModel.getTransactions().getValue(), wallet, addressBook));
}
}
use of de.schildbach.wallet.addressbook.AddressBookEntry in project bitcoin-wallet by bitcoin-wallet.
the class WalletTransactionsViewModel method maybePostList.
private void maybePostList() {
AsyncTask.execute(() -> {
org.bitcoinj.core.Context.propagate(Constants.CONTEXT);
final Set<Transaction> transactions = WalletTransactionsViewModel.this.transactions.getValue();
final MonetaryFormat format = configFormat.getValue();
final Map<String, AddressBookEntry> addressBook = AddressBookEntry.asMap(WalletTransactionsViewModel.this.addressBook.getValue());
if (transactions != null && format != null && addressBook != null) {
final List<Transaction> filteredTransactions = new ArrayList<>(transactions.size());
final Wallet wallet = application.getWallet();
final Direction direction = WalletTransactionsViewModel.this.direction.getValue();
for (final Transaction tx : transactions) {
final boolean sent = tx.getValue(wallet).signum() < 0;
final boolean isInternal = tx.getPurpose() == Purpose.KEY_ROTATION;
if ((direction == Direction.RECEIVED && !sent && !isInternal) || direction == null || (direction == Direction.SENT && sent && !isInternal))
filteredTransactions.add(tx);
}
Collections.sort(filteredTransactions, TRANSACTION_COMPARATOR);
list.postValue(TransactionsAdapter.buildListItems(application, filteredTransactions, warning.getValue(), wallet, addressBook, format, application.maxConnectedPeers()));
}
});
}
Aggregations