Permalink
Browse files

readme update

  • Loading branch information...
Brian Armstrong
Brian Armstrong committed Jul 6, 2011
1 parent 6aa0dbd commit 468ed6d566d7c92ddfce743252d15654a8295e4a
View
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>BitcoinWallet</name>
+ <name>BitcoinAndroid</name>
<comment></comment>
<projects>
</projects>
View
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.bitcoinwallet" android:versionCode="1"
+ package="com.bitcoinandroid" android:versionCode="1"
android:versionName="1.0" android:installLocation="preferExternal" >
<uses-sdk android:minSdkVersion="8" />
View
@@ -27,6 +27,8 @@ Features
* Wallet file backed up in the cloud (synced to your Google account) in case you lose your phone.
* A free app, 100% open source
+<iframe width="425" height="349" src="http://www.youtube.com/embed/W6EucS5RS24" frameborder="0" allowfullscreen></iframe>
+
Installation
-------------
@@ -1,140 +0,0 @@
-/* AUTO-GENERATED FILE. DO NOT MODIFY.
- *
- * This class was automatically generated by the
- * aapt tool from the resource data it found. It
- * should not be modified by hand.
- */
-
-package com.bitcoinwallet;
-
-public final class R {
- public static final class anim {
- public static final int rotate=0x7f040000;
- public static final int status_view_animation=0x7f040001;
- }
- public static final class attr {
- }
- public static final class color {
- public static final int contents_text=0x7f060000;
- public static final int encode_view=0x7f060001;
- public static final int help_button_view=0x7f060002;
- public static final int help_view=0x7f060003;
- public static final int possible_result_points=0x7f060004;
- public static final int result_image_border=0x7f060005;
- public static final int result_minor_text=0x7f060006;
- public static final int result_points=0x7f060007;
- public static final int result_text=0x7f060008;
- public static final int result_view=0x7f060009;
- public static final int sbc_header_text=0x7f06000a;
- public static final int sbc_header_view=0x7f06000b;
- public static final int sbc_layout_view=0x7f06000d;
- public static final int sbc_list_item=0x7f06000c;
- public static final int sbc_page_number_text=0x7f06000e;
- public static final int sbc_snippet_text=0x7f06000f;
- public static final int share_text=0x7f060010;
- public static final int share_view=0x7f060011;
- public static final int status_text=0x7f060013;
- public static final int status_view=0x7f060012;
- public static final int transparent=0x7f060014;
- public static final int viewfinder_frame=0x7f060015;
- public static final int viewfinder_laser=0x7f060016;
- public static final int viewfinder_mask=0x7f060017;
- }
- public static final class drawable {
- public static final int background=0x7f020000;
- public static final int ic_menu_refresh=0x7f020001;
- public static final int logo=0x7f020002;
- public static final int my_icon=0x7f020003;
- public static final int my_notification_icon=0x7f020004;
- }
- public static final class id {
- public static final int address=0x7f070020;
- public static final int amount=0x7f070029;
- /** Messages IDs
- */
- public static final int auto_focus=0x7f070000;
- public static final int balanceLabel=0x7f07001d;
- public static final int balanceTable=0x7f07001a;
- public static final int contents_text_view=0x7f070013;
- public static final int copy_button=0x7f070026;
- public static final int decode=0x7f070001;
- public static final int decode_failed=0x7f070002;
- public static final int decode_succeeded=0x7f070003;
- public static final int email_button=0x7f070025;
- public static final int encode_failed=0x7f070004;
- public static final int encode_succeeded=0x7f070005;
- public static final int encode_view=0x7f070011;
- public static final int header=0x7f070016;
- public static final int imageView1=0x7f070014;
- public static final int image_view=0x7f070012;
- public static final int launch_product_query=0x7f070006;
- public static final int linearLayout1=0x7f070017;
- public static final int linearLayout2=0x7f070024;
- public static final int manual_button=0x7f07000e;
- public static final int memo=0x7f07002b;
- public static final int preview_view=0x7f07000c;
- public static final int progressBar=0x7f070015;
- public static final int qr_code=0x7f070021;
- public static final int quit=0x7f070007;
- public static final int receive_amount=0x7f070023;
- public static final int receive_amount_label=0x7f070022;
- public static final int receive_button=0x7f070019;
- public static final int receive_money_layout=0x7f07001f;
- public static final int refresh_menu_item=0x7f07002d;
- public static final int relativeLayout1=0x7f070027;
- public static final int restart_preview=0x7f070008;
- public static final int return_scan_result=0x7f070009;
- public static final int search_book_contents_failed=0x7f07000a;
- public static final int search_book_contents_succeeded=0x7f07000b;
- public static final int send_button=0x7f070018;
- public static final int send_money_button=0x7f07002c;
- public static final int status_view=0x7f07000d;
- public static final int tableRow2=0x7f07001b;
- public static final int textView2=0x7f07001c;
- public static final int textView3=0x7f070028;
- public static final int textView4=0x7f07002a;
- public static final int toast_holder=0x7f070010;
- public static final int transactions=0x7f07001e;
- public static final int viewfinder_view=0x7f07000f;
- }
- public static final class layout {
- public static final int capture=0x7f030000;
- public static final int encode=0x7f030001;
- public static final int header=0x7f030002;
- public static final int main=0x7f030003;
- public static final int receive_money=0x7f030004;
- public static final int send_money=0x7f030005;
- }
- public static final class menu {
- public static final int main=0x7f0a0000;
- }
- public static final class raw {
- public static final int beep=0x7f050000;
- }
- public static final class string {
- public static final int address_label=0x7f080010;
- public static final int amount_label=0x7f08000f;
- public static final int amount_placeholder=0x7f080004;
- public static final int app_name=0x7f080000;
- public static final int balance_label=0x7f080003;
- public static final int blank_label=0x7f080008;
- public static final int contents_contact=0x7f08000a;
- public static final int contents_email=0x7f08000b;
- public static final int contents_location=0x7f08000c;
- public static final int contents_phone=0x7f08000d;
- public static final int contents_sms=0x7f08000e;
- public static final int contents_text=0x7f080009;
- public static final int manual_button_label=0x7f080007;
- public static final int memo_label=0x7f080011;
- public static final int msg_default_status=0x7f080006;
- public static final int receive_button=0x7f080002;
- public static final int scan_label=0x7f080005;
- public static final int send_button=0x7f080001;
- public static final int send_money_button=0x7f080012;
- }
- public static final class style {
- public static final int CustomTheme=0x7f090000;
- public static final int MainActivity=0x7f090001;
- public static final int Transaction=0x7f090002;
- }
-}
@@ -1,166 +0,0 @@
-package com.bitcoinwallet;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.InetSocketAddress;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-
-import org.apache.commons.io.IOUtils;
-
-import android.app.Application;
-import android.app.backup.BackupManager;
-import android.util.Log;
-
-import com.google.bitcoin.core.BlockChain;
-import com.google.bitcoin.core.BlockStore;
-import com.google.bitcoin.core.BlockStoreException;
-import com.google.bitcoin.core.BoundedOverheadBlockStore;
-import com.google.bitcoin.core.DnsDiscovery;
-import com.google.bitcoin.core.ECKey;
-import com.google.bitcoin.core.IrcDiscovery;
-import com.google.bitcoin.core.NetworkParameters;
-import com.google.bitcoin.core.Peer;
-import com.google.bitcoin.core.PeerDiscovery;
-import com.google.bitcoin.core.PeerDiscoveryException;
-import com.google.bitcoin.core.Sha256Hash;
-import com.google.bitcoin.core.Transaction;
-import com.google.bitcoin.core.Wallet;
-
-public class ApplicationState extends Application {
- // convenient place to keep global app variables
-
- boolean TEST_MODE = true;
- Wallet wallet;
- String filePrefix = TEST_MODE ? "testnet" : "prodnet";
-
- /**
- * Every access to walletFile must be synch'ed with this lock. Backup agent
- * can be run at any time.
- */
- static final Object[] walletFileLock = new Object[0];
- File walletFile;
- BackupManager backupManager;
-
- NetworkParameters params = TEST_MODE ? NetworkParameters.testNet()
- : NetworkParameters.prodNet();
- PeerDiscovery peerDiscovery;
- private ArrayList<InetSocketAddress> isas = new ArrayList<InetSocketAddress>();
- ArrayList<Peer> connectedPeers = new ArrayList<Peer>();
- BlockStore blockStore = null;
- BlockChain blockChain;
-
- //tracks which transactions we've shown a notification for so we couldn't duplicate them
- //could probably persist this between start/top of the app, but fine for now
- ArrayList<Sha256Hash> notifiedUserOfTheseTransactions = new ArrayList<Sha256Hash>();
-
- public static ApplicationState current;
-
- @Override
- public void onCreate() {
- Log.d("Wallet", "Starting app");
- ApplicationState.current = (ApplicationState) this;
- backupManager = new BackupManager(this);
-
-
- // read or create wallet
- synchronized (ApplicationState.walletFileLock) {
- walletFile = new File(getFilesDir(), filePrefix + ".wallet");
- try {
- wallet = Wallet.loadFromFile(walletFile);
- Log.d("Wallet", "Found wallet file to load");
- } catch (IOException e) {
- wallet = new Wallet(params);
- Log.d("Wallet", "Created new wallet");
- wallet.keychain.add(new ECKey());
- saveWallet();
- } catch (StackOverflowError e) {
- //couldn't unserialize the wallet - maybe it was saved in a previous version of bitcoinj?
- e.printStackTrace();
- }
- }
-
- if (TEST_MODE) {
- peerDiscovery = new IrcDiscovery("#bitcoinTEST");
- } else {
- peerDiscovery = new DnsDiscovery(params);
- }
-
- Log.d("Wallet", "Reading block store from disk");
- try {
- File file = new File(getExternalFilesDir(null), filePrefix
- + ".blockchain");
- if (!file.exists()) {
- Log.d("Wallet", "Copying initial blockchain from assets folder");
- try {
- InputStream is = getAssets().open(
- filePrefix + ".blockchain");
- IOUtils.copy(is, new FileOutputStream(file));
- } catch (IOException e) {
- Log.d("Wallet",
- "Couldn't find initial blockchain in assets folder...starting from scratch");
- }
- }
- blockStore = new BoundedOverheadBlockStore(params, file);
- blockChain = new BlockChain(params, wallet, blockStore);
- } catch (BlockStoreException bse) {
- throw new Error("Couldn't store block.");
- }
- }
-
- public void saveWallet() {
- synchronized (ApplicationState.walletFileLock) {
- Log.d("Wallet", "Saving wallet");
- try {
- wallet.saveToFile(walletFile);
- } catch (IOException e) {
- throw new Error("Can't save wallet file.");
- }
- }
- Log.d("Wallet", "Notifying BackupManager that data has changed. Should backup soon.");
- backupManager.dataChanged();
- }
-
- public synchronized void removeBadPeer(InetSocketAddress isa) {
- Log.d("Wallet", "removing bad peer");
- isas.remove(isa);
- }
-
- @SuppressWarnings("unchecked")
- public ArrayList<InetSocketAddress> discoverPeers() {
- if (isas.size() == 0) {
- try {
- isas.addAll(Arrays.asList(peerDiscovery.getPeers()));
- Collections.shuffle(isas); // try different order each time
- } catch (PeerDiscoveryException e) {
- Log.d("Wallet", "Couldn't discover peers.");
- }
- }
- Log.d("Wallet", "discoverPeers returning "+isas.size()+" peers");
- // shallow clone to prevent concurrent modification exceptions
- return (ArrayList<InetSocketAddress>) isas.clone();
- }
-
- /* rebroadcast pending transactions to all connected peers */
- public synchronized void sendTransaction(Transaction tx) {
- boolean success = false;
- for (Peer peer : connectedPeers) {
- try {
- peer.broadcastTransaction(tx);
- success = true;
- Log.d("Wallet", "Broadcast succeeded");
- } catch (IOException e) {
- peer.disconnect();
- connectedPeers.remove(peer);
- Log.d("Wallet", "Broadcast failed");
- }
- }
- if (success) {
- wallet.confirmSend(tx);
- saveWallet();
- }
- }
-}
Oops, something went wrong.

0 comments on commit 468ed6d

Please sign in to comment.