Java Code Examples for net.bither.bitherj.core.Tx#deltaAmountFrom()

The following examples show how to use net.bither.bitherj.core.Tx#deltaAmountFrom() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DialogAddressFullForHD.java    From bither-android with Apache License 2.0 6 votes vote down vote up
public DialogAddressFullForHD(Activity context, Tx tx, HDAccount account) {
    super(context);
    activity = context;
    List<String> inAddresses = tx.getInAddresses();
    List<String> outAddresses = tx.getOutAddressList();
    ownAddresses = account.getRelatedAddressesForTx(tx, inAddresses);
    Collections.sort(ownAddresses, new Comparator<HDAccount.HDAccountAddress>() {
        @Override
        public int compare(HDAccount.HDAccountAddress lhs, HDAccount.HDAccountAddress rhs) {
            if (lhs.getPathType() != rhs.getPathType()) {
                return lhs.getPathType().getValue() - rhs.getPathType().getValue();
            }
            return lhs.getIndex() - rhs.getIndex();
        }
    });
    boolean isIncoming = true;
    try {
        isIncoming = tx.deltaAmountFrom(account) >= 0;
    } catch (ScriptException e) {
        e.printStackTrace();
    }
    List<String> foreign = foreignAddresses(isIncoming ? inAddresses : outAddresses);
    initForeignAddresses(isIncoming, tx, foreign);
    initView();
}
 
Example 2
Source File: TxTableModel.java    From bither-desktop-java with Apache License 2.0 5 votes vote down vote up
@Override
public Object getValueAt(int row, int column) {
    Tx tx = null;
    if (row >= 0 && row < txList.size()) {
        tx = txList.get(row);
    }
    if (tx == null) {
        return null;
    }

    switch (column) {
        case 0:
            return tx;
        case 1: {
            if (tx.getTxDate() == null) {
                return new Date(0); // the earliest date (for sorting)
            } else {
                return tx.getTxDate();
            }
        }

        case 2:
            return tx.deltaAmountFrom(Bither.getActionAddress());

        default:
            return null;
    }
}
 
Example 3
Source File: DialogTransactionConfidence.java    From bither-android with Apache License 2.0 5 votes vote down vote up
public DialogTransactionConfidence(Context context, Tx tx, Address address) {
    super(context);
    this.tx = tx;
    this.address = address;
    setContentView(R.layout.dialog_transaction_confidence);
    TextView tv = (TextView) findViewById(R.id.tv_confirmation);
    long confidence = tx.getConfirmationCount();
    if (confidence <= 100) {
        tv.setText(Long.toString(confidence));
    } else {
        tv.setText("100+");
    }
    View llIconContainer = findViewById(R.id.ll_icon_container);
    pb = (ProgressBar) findViewById(R.id.pb);
    ivHot = (ImageView) findViewById(R.id.iv_hot);
    ivCold = (ImageView) findViewById(R.id.iv_cold);
    ivServer = (ImageView) findViewById(R.id.iv_server);
    showSigningInfo = address.isHDM() && tx.deltaAmountFrom(address) < 0;
    if (showSigningInfo) {
        llIconContainer.setVisibility(View.VISIBLE);
        pb.setVisibility(View.VISIBLE);
        ivHot.setVisibility(View.GONE);
        ivCold.setVisibility(View.GONE);
        ivServer.setVisibility(View.GONE);
    } else {
        pb.setVisibility(View.GONE);
        llIconContainer.setVisibility(View.GONE);
    }
    setOnShowListener(this);
}
 
Example 4
Source File: TxTableModel.java    From bither-desktop-java with Apache License 2.0 5 votes vote down vote up
@Override
public Object getValueAt(int row, int column) {
    Tx tx = null;
    if (row >= 0 && row < txList.size()) {
        tx = txList.get(row);
    }
    if (tx == null) {
        return null;
    }

    switch (column) {
        case 0:
            return tx;
        case 1: {
            if (tx.getTxDate() == null) {
                return new Date(0); // the earliest date (for sorting)
            } else {
                return tx.getTxDate();
            }
        }

        case 2:
            return tx.deltaAmountFrom(Bither.getActionAddress());

        default:
            return null;
    }
}