use of de.schildbach.wallet.ui.InputParser.StringInputParser in project bitcoin-wallet by bitcoin-wallet.
the class SendCoinsFragment method onActivityResultResumed.
private void onActivityResultResumed(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) {
setState(null);
updateStateFrom(paymentIntent);
}
@Override
protected void handleDirectTransaction(final Transaction transaction) throws VerificationException {
cannotClassify(input);
}
@Override
protected void error(final int messageResId, final Object... messageArgs) {
dialog(activity, null, R.string.button_scan, messageResId, messageArgs);
}
}.parse();
}
} else if (requestCode == REQUEST_CODE_ENABLE_BLUETOOTH_FOR_PAYMENT_REQUEST) {
if (paymentIntent.isBluetoothPaymentRequestUrl())
requestPaymentRequest();
} else if (requestCode == REQUEST_CODE_ENABLE_BLUETOOTH_FOR_DIRECT_PAYMENT) {
if (paymentIntent.isBluetoothPaymentUrl())
directPaymentEnableView.setChecked(resultCode == Activity.RESULT_OK);
}
}
use of de.schildbach.wallet.ui.InputParser.StringInputParser 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.ui.InputParser.StringInputParser 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.ui.InputParser.StringInputParser 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();
}
use of de.schildbach.wallet.ui.InputParser.StringInputParser in project bitcoin-wallet by bitcoin-wallet.
the class SweepWalletFragment 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 handlePrivateKey(final VersionedChecksummedBytes key) {
privateKeyToSweep = key;
setState(State.DECODE_KEY);
maybeDecodeKey();
}
@Override
protected void handlePaymentIntent(final PaymentIntent paymentIntent) {
cannotClassify(input);
}
@Override
protected void handleDirectTransaction(final Transaction transaction) throws VerificationException {
cannotClassify(input);
}
@Override
protected void error(final int messageResId, final Object... messageArgs) {
dialog(activity, null, R.string.button_scan, messageResId, messageArgs);
}
}.parse();
}
}
}
Aggregations