Skip to content

Commit

Permalink
Merge pull request #10 from m2049r/feature_send
Browse files Browse the repository at this point in the history
Sending
  • Loading branch information
m2049r authored Aug 20, 2017
2 parents d61198b + f19618e commit 35c3934
Show file tree
Hide file tree
Showing 35 changed files with 2,514 additions and 572 deletions.
1 change: 1 addition & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 13 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,36 @@ Another Android Monero Wallet

### QUICKSTART
- Download APK (Release) and install it
- Copy over synced wallet (all three files) onto sdcard in directory Monerujo (created first time app is started)
- Start app (again)
- Run the App and select "Generate Wallet" to create a new wallet or recover a wallet
- Advanced users could copy over synced wallet files (all files) onto sdcard in directory Monerujo (created first time App is started)
- see the [FAQ](doc/FAQ.md)

### Disclaimer
This is my first serious Android App.
You may loose all your Moneroj if you use this App.

### Random Notes
- Based off monero v0.10.3.1 with pull requests #2238, #2239 and #2289 applied => so can be used in mainnet!
- currently only android32
- currently only use is checking incoming/outgoing transactions
- works in testnet & mainnet (please use your own daemons)
- takes forever to sync on mainnet (even with own daemon) - due to 32-bit architecture
- ~~currently only use is checking incoming/outgoing transactions~~
- works in testnet & mainnet
- takes forever to sync due to 32-bit architecture
- use your own daemon - it's easy
- screen stays on until first sync is complete
- saves wallet only on first sync
- saves wallet only on first sync and when sending transactions or editing notes
- Monerujo means "Monero Wallet" according to https://www.reddit.com/r/Monero/comments/3exy7t/esperanto_corner/

### TODO
- make it pretty
- Display outgoing pending transactions
- wallet backup functions
- adjust layout so we can use bigger font sizes (maybe show only 5 decimal places instead of 12 in main view)
- review visibility of methods/classes
- sensible error dialogs (e.g. when no write permissions granted) instead of just crashing on purpose
- spend monero - not so difficult with wallet api
- more sensible error dialogs ~~(e.g. when no write permissions granted) instead of just crashing on purpose~~
- check licenses of included libraries; License Dialog
- ~~provide detailed build instructions for third party binaries~~
- ~~sensible loading/saving progress bars instead of just freezing up~~
- ~~figure out how to make it all flow better (loading/saving takes forever and does not run in background)~~
- ~~currently loading in background thread produces segfaults in JNI~~
- ~~make it pretty~~ (decided to go with "form follows function")
- ~~spend monero - not so difficult with wallet api~~

### Issues
- ~~screen rotation crashes the app~~
- ~~turning the display off/on during sync stops sync~~
- Pending incoming transactions disappear after reload

### HOW TO BUILD
No need to build. Binaries are included:
Expand Down
7 changes: 3 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@
android:name=".WalletActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/wallet_activity_name"
android:launchMode="singleTop"
android:screenOrientation="portrait"></activity>
android:screenOrientation="portrait" />

<activity
android:name=".LoginActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden">
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
307 changes: 172 additions & 135 deletions app/src/main/cpp/monerujo.cpp

Large diffs are not rendered by default.

77 changes: 20 additions & 57 deletions app/src/main/java/com/m2049r/xmrwallet/GenerateFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import android.content.Context;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.LayoutInflater;
Expand Down Expand Up @@ -66,10 +67,14 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
etWalletRestoreHeight = (EditText) view.findViewById(R.id.etWalletRestoreHeight);
bGenerate = (Button) view.findViewById(R.id.bGenerate);

etWalletMnemonic.setRawInputType(InputType.TYPE_CLASS_TEXT);
etWalletAddress.setRawInputType(InputType.TYPE_CLASS_TEXT);
etWalletViewKey.setRawInputType(InputType.TYPE_CLASS_TEXT);
etWalletSpendKey.setRawInputType(InputType.TYPE_CLASS_TEXT);

boolean testnet = WalletManager.getInstance().isTestNet();
etWalletMnemonic.setTextIsSelectable(testnet);
//etWalletMnemonic.setTextIsSelectable(testnet);

etWalletName.requestFocus();
Helper.showKeyboard(getActivity());
etWalletName.addTextChangedListener(new TextWatcher() {
@Override
Expand All @@ -89,12 +94,6 @@ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
});
etWalletName.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Helper.showKeyboard(getActivity());
}
});
etWalletName.setOnEditorActionListener(new TextView.OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_NEXT)) {
Expand All @@ -107,12 +106,6 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
}
});

etWalletPassword.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Helper.showKeyboard(getActivity());
}
});
etWalletPassword.setOnEditorActionListener(new TextView.OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_NEXT)) {
Expand Down Expand Up @@ -142,26 +135,18 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
return false;
}
});
etWalletMnemonic.setOnClickListener(new View.OnClickListener()

{
@Override
public void onClick(View v) {
Helper.showKeyboard(getActivity());
}
});
etWalletMnemonic.addTextChangedListener(new

TextWatcher() {
@Override
public void afterTextChanged(Editable editable) {
if (etWalletMnemonic.length() > 0) {
etWalletRestoreHeight.setVisibility(View.VISIBLE);
etWalletAddress.setVisibility(View.INVISIBLE);
etWalletAddress.setVisibility(View.GONE);
} else {
etWalletAddress.setVisibility(View.VISIBLE);
if (etWalletAddress.length() == 0) {
etWalletRestoreHeight.setVisibility(View.INVISIBLE);
etWalletRestoreHeight.setVisibility(View.GONE);
} else {
etWalletRestoreHeight.setVisibility(View.VISIBLE);
}
Expand Down Expand Up @@ -198,14 +183,6 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
return false;
}
});
etWalletAddress.setOnClickListener(new View.OnClickListener()

{
@Override
public void onClick(View v) {
Helper.showKeyboard(getActivity());
}
});
etWalletAddress.addTextChangedListener(new

TextWatcher() {
Expand All @@ -216,10 +193,10 @@ public void afterTextChanged(Editable editable) {
etWalletMnemonic.setVisibility(View.INVISIBLE);
etWalletRestoreHeight.setVisibility(View.VISIBLE);
} else {
llRestoreKeys.setVisibility(View.INVISIBLE);
llRestoreKeys.setVisibility(View.GONE);
etWalletMnemonic.setVisibility(View.VISIBLE);
if (etWalletMnemonic.length() == 0) {
etWalletRestoreHeight.setVisibility(View.INVISIBLE);
etWalletRestoreHeight.setVisibility(View.GONE);
} else {
etWalletRestoreHeight.setVisibility(View.VISIBLE);
}
Expand Down Expand Up @@ -250,15 +227,6 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
return false;
}
});
etWalletViewKey.setOnClickListener(new View.OnClickListener()

{
@Override
public void onClick(View v) {
Helper.showKeyboard(getActivity());
}
});

etWalletSpendKey.setOnEditorActionListener(new TextView.OnEditorActionListener()

{
Expand All @@ -274,23 +242,16 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
return false;
}
});
etWalletSpendKey.setOnClickListener(new View.OnClickListener()

{
@Override
public void onClick(View v) {
Helper.showKeyboard(getActivity());
}
});

etWalletRestoreHeight.setOnEditorActionListener(new TextView.OnEditorActionListener()

{
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_NEXT)) {
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
if (bGenerate.getVisibility() == View.VISIBLE) {
Helper.hideKeyboard(getActivity());
generateWallet();
} else {
Toast.makeText(getActivity(), getString(R.string.generate_check_something), Toast.LENGTH_LONG).show();
}
return true;
}
Expand All @@ -308,6 +269,7 @@ public void onClick(View v) {
}
});

etWalletName.requestFocus();
return view;
}

Expand All @@ -318,7 +280,8 @@ private boolean mnemonicOk() {

private boolean addressOk() {
String address = etWalletAddress.getText().toString();
return ((address.length() == 95) && ("49A".indexOf(address.charAt(0)) >= 0));
boolean testnet = WalletManager.getInstance().isTestNet();
return ((address.length() == 95) && ((testnet ? "9A" : "4").indexOf(address.charAt(0)) >= 0));
}

private boolean viewKeyOk() {
Expand Down Expand Up @@ -355,19 +318,19 @@ private void generateWallet() {
// figure out how we want to create this wallet
// A. from scratch
if ((seed.length() == 0) && (address.length() == 0)) {
bGenerate.setVisibility(View.INVISIBLE);
bGenerate.setVisibility(View.GONE);
activityCallback.onGenerate(name, password);
} else
// B. from seed
if (mnemonicOk()) {
bGenerate.setVisibility(View.INVISIBLE);
bGenerate.setVisibility(View.GONE);
activityCallback.onGenerate(name, password, seed, height);
} else
// C. from keys
if (addressOk() && viewKeyOk() && (spendKeyOk())) {
String viewKey = etWalletViewKey.getText().toString();
String spendKey = etWalletSpendKey.getText().toString();
bGenerate.setVisibility(View.INVISIBLE);
bGenerate.setVisibility(View.GONE);
activityCallback.onGenerate(name, password, address, viewKey, spendKey, height);
} else
// D. none of the above :)
Expand Down
Loading

0 comments on commit 35c3934

Please sign in to comment.