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

The following examples show how to use net.bither.bitherj.core.Tx#getConfirmationCount() . 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: 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 2
Source File: AddressFragmentListItemView.java    From bither-android with Apache License 2.0 4 votes vote down vote up
private void showAddressInfo() {
        if (address == null) {
            return;
        }
        tvAddress.setText(address.getShortAddress(AppSharedPreference.getInstance().isSegwitAddressType()));
        tvBalanceMoney.setVisibility(View.VISIBLE);
        ivBalanceSymbol.setVisibility(View.VISIBLE);
        llExtra.setVisibility(View.VISIBLE);
        llMonitorFailed.setVisibility(View.GONE);
        tvTransactionCount.setVisibility(View.GONE);
        ivBalanceSymbol.setImageBitmap(UnitUtilWrapper.getBtcSlimSymbol(tvBalance));
        if (address.isHDAccount()) {
            ivType.setImageResource(R.drawable.address_type_hd_selector);
        } else if (address.isHDM()) {
            ivType.setImageResource(R.drawable.address_type_hdm_selector);
        }else if (address.hasPrivKey()) {
            ivType.setImageResource(R.drawable.address_type_private_selector);
        } else {
            ivType.setImageResource(R.drawable.address_type_watchonly_selector);
        }
        if (this.address != null && this.address.isSyncComplete()) {
            tvBalance.setText(UnitUtilWrapper.formatValueWithBold(this.address.getBalance()));
            tvBalanceMoney.setBigInteger(BigInteger.valueOf(this.address.getBalance()));
//            tvTransactionCount.setText(Integer.toString(this.address.txCount()));

            Tx lastTransaction = null;
            if (this.address.txCount() > 0) {
                List<Tx> txList = this.address.getRecentlyTxsWithConfirmationCntLessThan(6, 1);
                if (txList.size() > 0) {
                    lastTransaction = txList.get(0);
                }
            }
            if (lastTransaction != null && lastTransaction.getConfirmationCount() < 6) {
                vTransactionImmuture.setVisibility(View.VISIBLE);
                vTransactionImmuture.setTransaction(lastTransaction, address);
            } else {
                vTransactionImmuture.setVisibility(View.GONE);
            }
            if (vTransactionImmuture.getVisibility() == View.GONE) {
                tvTransactionCount.setVisibility(View.VISIBLE);
            }
        } else {
            ivBalanceSymbol.setVisibility(View.GONE);
            tvBalance.setText(BitherSetting.UNKONW_ADDRESS_STRING);
            tvBalanceMoney.setBigInteger(null);
            vTransactionImmuture.setVisibility(View.GONE);
        }
        if (address.isFromXRandom()) {
            ibtnXRandomLabel.setVisibility(View.VISIBLE);
        } else {
            ibtnXRandomLabel.setVisibility(View.GONE);
        }

        if (!(address instanceof HDAccount) && !Utils.isEmpty(address.getAlias())) {
            btnAlias.setVisibility(View.VISIBLE);
            btnAlias.setText(address.getAlias());
        } else {
            btnAlias.setText("");
            btnAlias.setVisibility(View.INVISIBLE);
        }
    }
 
Example 3
Source File: ImageLoader.java    From bither-desktop-java with Apache License 2.0 3 votes vote down vote up
private static ImageIcon getConfidenceIcon(Tx tx) {
    // By default return a triangle which indicates the least known.
    ImageIcon iconToReturn = shapeTriangleIcon;


    if (tx.getConfirmationCount() == 0) {
        return progress0Icon;
    }


    return iconToReturn;
}
 
Example 4
Source File: ImageLoader.java    From bither-desktop-java with Apache License 2.0 3 votes vote down vote up
private static ImageIcon getConfidenceIcon(Tx tx) {
    // By default return a triangle which indicates the least known.
    ImageIcon iconToReturn = shapeTriangleIcon;


    if (tx.getConfirmationCount() == 0) {
        return progress0Icon;
    }


    return iconToReturn;
}