If you think the Android project bitfynd-wallet-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/*
* Copyright 2013-2014 the original author or authors.
*/*www.java2s.com*/
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/package de.schildbach.wallet.ui;
import javax.annotation.Nonnull;
import org.bitcoinj.core.Transaction;
import org.bitcoinj.core.VerificationException;
import org.bitcoinj.core.VersionedChecksummedBytes;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import de.schildbach.wallet.WalletApplication;
import de.schildbach.wallet.data.PaymentIntent;
import de.schildbach.wallet.ui.InputParser.StringInputParser;
import de.schildbach.wallet.ui.send.SendCoinsActivity;
import de.schildbach.wallet.ui.send.SweepWalletActivity;
/**
* @author Andreas Schildbach
*/publicfinalclass SendCoinsQrActivity extends ActionBarActivity
{
privatestaticfinalint REQUEST_CODE_SCAN = 0;
@Override
protectedvoid onCreate(final Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
startActivityForResult(new Intent(this, ScanActivity.class), REQUEST_CODE_SCAN);
}
@Override
publicvoid onActivityResult(finalint requestCode, finalint 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
protectedvoid handlePaymentIntent(@Nonnull final PaymentIntent paymentIntent)
{
SendCoinsActivity.start(SendCoinsQrActivity.this, paymentIntent);
SendCoinsQrActivity.this.finish();
}
@Override
protectedvoid handlePrivateKey(@Nonnull final VersionedChecksummedBytes key)
{
SweepWalletActivity.start(SendCoinsQrActivity.this, key);
SendCoinsQrActivity.this.finish();
}
@Override
protectedvoid handleDirectTransaction(final Transaction transaction) throws VerificationException
{
final WalletApplication application = (WalletApplication) getApplication();
application.processDirectTransaction(transaction);
SendCoinsQrActivity.this.finish();
}
@Override
protectedvoid error(finalint messageResId, final Object... messageArgs)
{
dialog(SendCoinsQrActivity.this, dismissListener, 0, messageResId, messageArgs);
}
privatefinal OnClickListener dismissListener = new OnClickListener()
{
@Override
publicvoid onClick(final DialogInterface dialog, finalint which)
{
SendCoinsQrActivity.this.finish();
}
};
}.parse();
}
else
{
finish();
}
}
}