本文整理汇总了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();
}
示例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);
}
}
示例3: uri
import com.google.bitcoin.uri.BitcoinURI; //导入方法依赖的package包/类
public String uri() {
return BitcoinURI.convertToBitcoinURI(getAddress(), null, Main.APP_NAME, null);
}
示例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);
}
示例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));
}
示例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);
}
示例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");
}