public TransactionAmountVisualizerAdapter(final Context context, final AbstractWallet walletPocket) { this.context = context; inflater = LayoutInflater.from(context); pocket = walletPocket; type = pocket.getCoinType(); symbol = type.getSymbol(); outputs = new ArrayList<>(); }
@CheckForNull public static List<AbstractAddress> getReceivedWithOrFrom(@Nonnull final AbstractTransaction tx, @Nonnull final AbstractWallet pocket) { // TODO a better approach is to use a "features" enum list and check agaist that if (pocket.getCoinType() instanceof NxtFamily) { return tx.getReceivedFrom(); } else { return getToAddresses(tx, pocket, true); } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { accountId = getArguments().getString(Constants.ARG_ACCOUNT_ID); } pocket = (AbstractWallet) getWalletApplication().getAccount(accountId); if (pocket == null) { Toast.makeText(getActivity(), R.string.no_such_pocket_error, Toast.LENGTH_LONG).show(); // TODO report anomaly return; } type = pocket.getCoinType(); }
@Override public boolean equals(WalletAccount other) { return other != null && getId().equals(other.getId()) && getCoinType().equals(other.getCoinType()); } }
@Override public Value getValue(AbstractWallet wallet) { if (tx.getSenderId() == wallet.getReceiveAddress().getId()) { return Value.valueOf(wallet.getCoinType(), -1 * tx.getAmountNQT()); } else { return Value.valueOf(wallet.getCoinType(), tx.getAmountNQT()); } }
sourceAccount = (AbstractWallet) checkNotNull(application.getAccount(fromAccountId)); application.maybeConnectAccount(sourceAccount); sourceType = sourceAccount.getCoinType(); emptyWallet = args.getBoolean(ARG_EMPTY_WALLET, false); sendAmount = (Value) args.getSerializable(ARG_SEND_VALUE);
final boolean sent = value.signum() < 0; final CoinType type = walletPocket.getCoinType(); rowDirectionText.setText(sentToTitle); rowDirectionFontIcon.setText(fontIconSentTo); } else if (walletPocket.getCoinType().getFamily() != Families.NXT) { rowDirectionText.setText(receivedWithTitle); rowDirectionFontIcon.setText(fontIconReceivedWith);
public void setTransaction(AbstractTransaction tx) { outputs.clear(); final Value value = tx.getValue(pocket); isSending = value.signum() < 0; // if sending and all the outputs point inside the current pocket it is an internal transfer boolean isInternalTransfer = isSending; for (AbstractOutput output : tx.getSentTo()) { if (isSending) { // When sending hide change outputs if (pocket.isAddressMine(output.getAddress())) continue; isInternalTransfer = false; } else { if (pocket.getCoinType() instanceof NxtFamily) { // TODO review the following outputs.add(new AbstractOutput(tx.getReceivedFrom().get(0), tx.getValue(pocket))); break; } // When receiving hide outputs that are not ours if (!pocket.isAddressMine(output.getAddress())) continue; } outputs.add(output); } feeAmount = tx.getFee(); hasFee = feeAmount != null && !feeAmount.isZero(); itemCount = isInternalTransfer ? 1 : outputs.size(); itemCount += hasFee ? 1 : 0; notifyDataSetChanged(); }
setupBlockExplorerLink(pocket.getCoinType(), tx.getHashAsString());