use of de.schildbach.wallet.data.PaymentIntent in project bitcoin-wallet by bitcoin-wallet.
the class SendCoinsQrActivity method onActivityResult.
@Override
public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) {
if (requestCode == REQUEST_CODE_SCAN && resultCode == Activity.RESULT_OK) {
final String input = intent.getStringExtra(ScanActivity.INTENT_EXTRA_RESULT);
new StringInputParser(input) {
@Override
protected void handlePaymentIntent(final PaymentIntent paymentIntent) {
SendCoinsActivity.start(SendCoinsQrActivity.this, paymentIntent);
SendCoinsQrActivity.this.finish();
}
@Override
protected void handlePrivateKey(final VersionedChecksummedBytes key) {
if (Constants.ENABLE_SWEEP_WALLET) {
SweepWalletActivity.start(SendCoinsQrActivity.this, key);
SendCoinsQrActivity.this.finish();
} else {
super.handlePrivateKey(key);
}
}
@Override
protected void handleDirectTransaction(final Transaction transaction) throws VerificationException {
final WalletApplication application = (WalletApplication) getApplication();
application.processDirectTransaction(transaction);
SendCoinsQrActivity.this.finish();
}
@Override
protected void error(final int messageResId, final Object... messageArgs) {
dialog(SendCoinsQrActivity.this, dismissListener, 0, messageResId, messageArgs);
}
private final OnClickListener dismissListener = new OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int which) {
SendCoinsQrActivity.this.finish();
}
};
}.parse();
} else {
finish();
}
}
use of de.schildbach.wallet.data.PaymentIntent in project bitcoin-wallet by bitcoin-wallet.
the class WalletActivity method onActivityResult.
@Override
public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) {
if (requestCode == REQUEST_CODE_SCAN) {
if (resultCode == Activity.RESULT_OK) {
final String input = intent.getStringExtra(ScanActivity.INTENT_EXTRA_RESULT);
new StringInputParser(input) {
@Override
protected void handlePaymentIntent(final PaymentIntent paymentIntent) {
SendCoinsActivity.start(WalletActivity.this, paymentIntent);
}
@Override
protected void handlePrivateKey(final VersionedChecksummedBytes key) {
if (Constants.ENABLE_SWEEP_WALLET)
SweepWalletActivity.start(WalletActivity.this, key);
else
super.handlePrivateKey(key);
}
@Override
protected void handleDirectTransaction(final Transaction tx) throws VerificationException {
application.processDirectTransaction(tx);
}
@Override
protected void error(final int messageResId, final Object... messageArgs) {
dialog(WalletActivity.this, null, R.string.button_scan, messageResId, messageArgs);
}
}.parse();
}
} else {
super.onActivityResult(requestCode, resultCode, intent);
}
}
use of de.schildbach.wallet.data.PaymentIntent in project bitcoin-wallet by bitcoin-wallet.
the class SendCoinsFragment method initStateFromIntentExtras.
private void initStateFromIntentExtras(final Bundle extras) {
final PaymentIntent paymentIntent = extras.getParcelable(SendCoinsActivity.INTENT_EXTRA_PAYMENT_INTENT);
final FeeCategory feeCategory = (FeeCategory) extras.getSerializable(SendCoinsActivity.INTENT_EXTRA_FEE_CATEGORY);
if (feeCategory != null) {
log.info("got fee category {}", feeCategory);
this.feeCategory = feeCategory;
}
updateStateFrom(paymentIntent);
}
use of de.schildbach.wallet.data.PaymentIntent in project bitcoin-wallet by bitcoin-wallet.
the class SendCoinsFragment method initStateFromIntentUri.
private void initStateFromIntentUri(final String mimeType, final Uri bitcoinUri) {
try {
final InputStream is = contentResolver.openInputStream(bitcoinUri);
new StreamInputParser(mimeType, is) {
@Override
protected void handlePaymentIntent(final PaymentIntent paymentIntent) {
updateStateFrom(paymentIntent);
}
@Override
protected void error(final int messageResId, final Object... messageArgs) {
dialog(activity, activityDismissListener, 0, messageResId, messageArgs);
}
}.parse();
} catch (final FileNotFoundException x) {
throw new RuntimeException(x);
}
}
use of de.schildbach.wallet.data.PaymentIntent in project bitcoin-wallet by bitcoin-wallet.
the class SendCoinsFragment method initStateFromBitcoinUri.
private void initStateFromBitcoinUri(final Uri bitcoinUri) {
final String input = bitcoinUri.toString();
new StringInputParser(input) {
@Override
protected void handlePaymentIntent(final PaymentIntent paymentIntent) {
updateStateFrom(paymentIntent);
}
@Override
protected void handlePrivateKey(final VersionedChecksummedBytes key) {
throw new UnsupportedOperationException();
}
@Override
protected void handleDirectTransaction(final Transaction transaction) throws VerificationException {
throw new UnsupportedOperationException();
}
@Override
protected void error(final int messageResId, final Object... messageArgs) {
dialog(activity, activityDismissListener, 0, messageResId, messageArgs);
}
}.parse();
}
Aggregations