use of de.schildbach.wallet.ui.InputParser.StringInputParser in project bitcoin-wallet by bitcoin-wallet.
the class SendingAddressesFragment 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) {
// workaround for "IllegalStateException: Can not perform this action after
// onSaveInstanceState"
handler.postDelayed(new Runnable() {
@Override
public void run() {
if (paymentIntent.hasAddress()) {
final Address address = paymentIntent.getAddress();
if (!wallet.isPubKeyHashMine(address.getHash160()))
EditAddressBookEntryFragment.edit(getFragmentManager(), address);
else
dialog(activity, null, R.string.address_book_options_scan_title, R.string.address_book_options_scan_own_address);
} else {
dialog(activity, null, R.string.address_book_options_scan_title, R.string.address_book_options_scan_invalid);
}
}
}, 500);
}
@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.address_book_options_scan_title, messageResId, messageArgs);
}
}.parse();
}
}
Aggregations