Search in sources :

Example 1 with StreamInputParser

use of de.schildbach.wallet.ui.InputParser.StreamInputParser 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);
    }
}
Also used : StreamInputParser(de.schildbach.wallet.ui.InputParser.StreamInputParser) InputStream(java.io.InputStream) FileNotFoundException(java.io.FileNotFoundException) PaymentIntent(de.schildbach.wallet.data.PaymentIntent)

Aggregations

PaymentIntent (de.schildbach.wallet.data.PaymentIntent)1 StreamInputParser (de.schildbach.wallet.ui.InputParser.StreamInputParser)1 FileNotFoundException (java.io.FileNotFoundException)1 InputStream (java.io.InputStream)1