当前位置: 首页>>代码示例>>Java>>正文


Java BitcoinURI.convertToBitcoinURI方法代码示例

本文整理汇总了Java中com.google.bitcoin.uri.BitcoinURI.convertToBitcoinURI方法的典型用法代码示例。如果您正苦于以下问题:Java BitcoinURI.convertToBitcoinURI方法的具体用法?Java BitcoinURI.convertToBitcoinURI怎么用?Java BitcoinURI.convertToBitcoinURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.bitcoin.uri.BitcoinURI的用法示例。


在下文中一共展示了BitcoinURI.convertToBitcoinURI方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: determineRequestStr

import com.google.bitcoin.uri.BitcoinURI; //导入方法依赖的package包/类
private String determineRequestStr(final boolean includeBluetoothMac)
{
	final boolean includeLabel = includeLabelView.isChecked();

	final ECKey key = (ECKey) addressView.getSelectedItem();
	final Address address = key.toAddress(Constants.NETWORK_PARAMETERS);
	final String label = includeLabel ? AddressBookProvider.resolveLabel(activity, address.toString()) : null;
	final BigInteger amount = amountCalculatorLink.getAmount();

	final StringBuilder uri = new StringBuilder(BitcoinURI.convertToBitcoinURI(address, amount, label, null));
	if (includeBluetoothMac && bluetoothMac != null)
	{
		uri.append(amount == null && label == null ? '?' : '&');
		uri.append(Bluetooth.MAC_URI_PARAM).append('=').append(bluetoothMac);
	}
	return uri.toString();
}
 
开发者ID:9cat,项目名称:templecoin-android-wallet,代码行数:18,代码来源:RequestCoinsFragment.java

示例2: updateView

import com.google.bitcoin.uri.BitcoinURI; //导入方法依赖的package包/类
private void updateView() {
	final Address selectedAddress = application.determineSelectedAddress();

	if (!selectedAddress.equals(lastSelectedAddress)) {
		lastSelectedAddress = selectedAddress;

		Editable dispAddress = WalletUtils.formatAddress(selectedAddress,
				Constants.ADDRESS_FORMAT_GROUP_SIZE,
				Constants.ADDRESS_FORMAT_LINE_SIZE);

		Log.d("disp address", dispAddress.toString());

		bitcoinAddressLabel.setText(dispAddress);

		final String addressStr = BitcoinURI.convertToBitcoinURI(
				selectedAddress, null, null, null);

		final int size = (int) (256 * getResources().getDisplayMetrics().density);
		qrCodeBitmap = Qr.bitmap(addressStr, size);
		bitcoinAddressQrView.setImageBitmap(qrCodeBitmap);

		Nfc.publishUri(nfcManager, getActivity(), addressStr);
	}
}
 
开发者ID:9cat,项目名称:templecoin-android-wallet,代码行数:25,代码来源:WalletAddressFragment.java

示例3: uri

import com.google.bitcoin.uri.BitcoinURI; //导入方法依赖的package包/类
public String uri() {
    return BitcoinURI.convertToBitcoinURI(getAddress(), null, Main.APP_NAME, null);
}
 
开发者ID:HashEngineering,项目名称:megacoinj,代码行数:4,代码来源:ClickableBitcoinAddress.java

示例4: showAddress

import com.google.bitcoin.uri.BitcoinURI; //导入方法依赖的package包/类
public void showAddress() {
    BTCFmt btcfmt = mBase.getBTCFmt();

    Address addr = mBase.getWalletService().nextReceiveAddress();
    String addrstr = addr.toString();

    TextView addrtv =
        (TextView) getActivity().findViewById(R.id.receive_addr);
    addrtv.setText(addrstr);
    addrtv.setVisibility(View.VISIBLE);

    String ss = mBTCAmountEditText.getText().toString();
    long bb = btcfmt.parse(ss.toString());
    BigInteger amt = bb == 0 ? null : BigInteger.valueOf(bb);

    String uri = BitcoinURI.convertToBitcoinURI(addrstr, amt, null, null);

    mLogger.info("view address uri=" + uri);

    final int size =
        (int) (240 * getResources().getDisplayMetrics().density);

    // Load the QR bitmap.
    Bitmap bm = createBitmap(uri, size);
    if (bm != null) {
        ImageView iv =
            (ImageView) getActivity().findViewById(R.id.receive_qr_view);
        iv.setImageBitmap(bm);
        iv.setVisibility(View.VISIBLE);
    }

    // Find the HDAddress object associated with this address.
    HDAddressDescription addrdesc =
        mBase.getWalletService().findAddress(addr);
    mHDAddress = addrdesc.hdAddress;
    mTransitioned = false;

    mFiatAmountEditText.setFocusable(false);
    mFiatAmountEditText.setFocusableInTouchMode(false);
    mBTCAmountEditText.setFocusable(false);
    mBTCAmountEditText.setFocusableInTouchMode(false);
}
 
开发者ID:ksedgwic,项目名称:BTCReceive,代码行数:43,代码来源:ReceiveFragment.java

示例5: handleShowQr

import com.google.bitcoin.uri.BitcoinURI; //导入方法依赖的package包/类
private void handleShowQr(final String address)
{
	final String uri = BitcoinURI.convertToBitcoinURI(address, null, null, null);
	final int size = (int) (256 * getResources().getDisplayMetrics().density);
	BitmapFragment.show(getFragmentManager(), Qr.bitmap(uri, size));
}
 
开发者ID:9cat,项目名称:templecoin-android-wallet,代码行数:7,代码来源:SendingAddressesFragment.java

示例6: generateCoinSparkQRcode

import com.google.bitcoin.uri.BitcoinURI; //导入方法依赖的package包/类
/**
     * generate a QR code for coinspark asset transfer
     * @param address
     *            Coinspark address to show
     * @aram assetRef
     *		  Asset ref of asset, otherwise null for regular Bitcoin
     * @param amount
     *            amount of asset (in display units)
     * @param label
     *            label for swatch
     * @return
     */
    public BufferedImage generateCoinSparkQRcode(String address, String assetRef, String amount, String label, int scaleFactor) {
	//System.out.println(String.format("generateCoinSparkQRcode() invoked: address=%s, assetRef=%s, amount=%s, label=%s", address, assetRef, amount, label));
	String bitcoinURI = null;
	String qrAddress = null;
	CoinSparkAddress csa = CSMiscUtils.decodeCoinSparkAddress(address);
	if (csa != null) {
	    String btcAddress = CSMiscUtils.getBitcoinAddressStringFromCoinSparkAddress(csa);
	    if (btcAddress != null) {
		try {
		    if (btcAddress != null) {
			new Address(this.bitcoinController.getModel().getNetworkParameters(), btcAddress);
			qrAddress = address; // no exception, so valid coinspark (and btc) addrss
		    }
		} catch (AddressFormatException afe) {
		    // Bad underlying Bitcoin address, so return null from outer try catch
		    return null;
		} catch (java.lang.StringIndexOutOfBoundsException e) {
		    return null;
		}
	    }
	}
	
	if (qrAddress != null && !"".equals(qrAddress)) {

	    // If coinspark address, and asset ref is defined, than this is not bitcoin but a coinspark asset
	    if (assetRef != null && !"".equals(assetRef)) {
		label = "<CSAssetRef>" + assetRef + "</CSAssetRef>" + label;
		    // FIXME: For now, we use tags, unlikely to be also used by human in label
		//        and because we want to re-use BitcoinURI.java (for now)
	    }

	    if (amount != null && !"".equals(amount)) {
		    // FIXME: For now just use this code, in future we just want to keep display units as is.
		// or create biddecimal.
		CurrencyConverterResult converterResult = CurrencyConverter.INSTANCE.parseToBTCNotLocalised(amount);
		if (converterResult.isBtcMoneyValid()) {
		    bitcoinURI = BitcoinURI.convertToBitcoinURI(qrAddress, converterResult.getBtcMoney().getAmount().toBigInteger(), label, null);
		} else {
		    // No parsable amount - show nothing.  
		}
	    } else {
		bitcoinURI = BitcoinURI.convertToBitcoinURI(qrAddress, null, label, null);
	    }

	    // FIXME: Temporary fudge as we use BitcoinURI, we change scheme from Bitcoin to Coinspark
	    if (bitcoinURI != null) {
		bitcoinURI = bitcoinURI.replaceFirst("bitcoin:", "coinspark:");
	    }
	}
	this.bitcoinController.getModel().setActiveWalletPreference(BitcoinModel.SEND_PERFORM_PASTE_NOW, "false");

	if (bitcoinURI==null) return null;
	
//	System.out.println("coinspark bitcoinURI = " + bitcoinURI);

	return generateImageFromURI(bitcoinURI, scaleFactor);
    }
 
开发者ID:coinspark,项目名称:sparkbit,代码行数:70,代码来源:QRCodeGenerator.java

示例7: onCreate

import com.google.bitcoin.uri.BitcoinURI; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {

	super.onCreate(savedInstanceState);

	setContentView(R.layout.activity_view_address);

       Intent intent = getIntent();
       mAddress = intent.getExtras().getString("address");
       mAmount = intent.getExtras().getLong("amount");

       BigInteger amt = mAmount == 0 ? null : BigInteger.valueOf(mAmount);

       mURI = BitcoinURI.convertToBitcoinURI(mAddress, amt, null, null);

       mLogger.info("view address uri=" + mURI);

       final int size =
           (int) (240 * getResources().getDisplayMetrics().density);

       Bitmap bm = createBitmap(mURI, size);
       if (bm != null) {
           ImageView iv = (ImageView) findViewById(R.id.address_qr_view);
           iv.setImageBitmap(bm);
       }

       TextView idtv = (TextView) findViewById(R.id.address);
       idtv.setText(mAddress);

       updateAmount();

       mLogger.info("ViewAddressActivity created");
}
 
开发者ID:ksedgwic,项目名称:BTCReceive,代码行数:34,代码来源:ViewAddressActivity.java


注:本文中的com.google.bitcoin.uri.BitcoinURI.convertToBitcoinURI方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。