1
mirror of https://github.com/m2049r/xmrwallet synced 2025-09-03 08:23:04 +02:00

Compare commits

...

8 Commits

Author SHA1 Message Date
m2049r
dceca0e198 new version 2017-09-26 22:58:08 +02:00
m2049r
94947de9ef Minor fixes (#88)
* another attempt to fix android.view.WindowManager

* trim entered daemon
2017-09-26 21:41:58 +02:00
m2049r
10ea6d8e0c Update FAQ.md 2017-09-26 08:02:55 +02:00
m2049r
0d03b75785 Poppins license (#86) 2017-09-25 23:12:43 +02:00
m2049r
a3db07c6a7 Bugfixes (#85)
* android.view.WindowManager

* refactor

* lock_guard listener

* new version
2017-09-25 22:53:16 +02:00
m2049r
6678222202 Bugfix: Generate screen is now scrollable (#84)
* generate+detail screens made scrollable

* new version
2017-09-23 22:26:12 +02:00
m2049r
793d984200 Bugfix: crashing on android 5 & 6 (new wallet, receive, ...) (#83)
* getAddress() mess fixed

* v0.8.0.3
2017-09-23 18:23:41 +02:00
m2049r
cc46dc06c4 Bugfixes (#82)
* cache getAddress()

* savedInstanceState handling

* v0.8.0.2
2017-09-23 14:16:30 +02:00
29 changed files with 280 additions and 228 deletions

View File

@@ -8,8 +8,8 @@ android {
applicationId "com.m2049r.xmrwallet"
minSdkVersion 21
targetSdkVersion 25
versionCode 14
versionName "0.8.0.1"
versionCode 20
versionName "0.8.0.7"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {

View File

@@ -39,6 +39,8 @@ static jclass class_WalletListener;
static jclass class_TransactionInfo;
static jclass class_Transfer;
std::mutex _listenerMutex;
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
cachedJVM = jvm;
LOGI("JNI_OnLoad");
@@ -101,6 +103,7 @@ struct MyWalletListener : Bitmonero::WalletListener {
};
void deleteGlobalJavaRef(JNIEnv *env) {
std::lock_guard<std::mutex> lock(_listenerMutex);
env->DeleteGlobalRef(jlistener);
jlistener = nullptr;
}
@@ -109,6 +112,7 @@ struct MyWalletListener : Bitmonero::WalletListener {
* @brief updated - generic callback, called when any event (sent/received/block reveived/etc) happened with the wallet;
*/
void updated() {
std::lock_guard<std::mutex> lock(_listenerMutex);
if (jlistener == nullptr) return;
LOGD("updated");
JNIEnv *jenv;
@@ -128,6 +132,7 @@ struct MyWalletListener : Bitmonero::WalletListener {
* @param amount - amount
*/
void moneySpent(const std::string &txId, uint64_t amount) {
std::lock_guard<std::mutex> lock(_listenerMutex);
if (jlistener == nullptr) return;
LOGD("moneySpent %"
PRIu64, amount);
@@ -139,6 +144,7 @@ struct MyWalletListener : Bitmonero::WalletListener {
* @param amount - amount
*/
void moneyReceived(const std::string &txId, uint64_t amount) {
std::lock_guard<std::mutex> lock(_listenerMutex);
if (jlistener == nullptr) return;
LOGD("moneyReceived %"
PRIu64, amount);
@@ -150,6 +156,7 @@ struct MyWalletListener : Bitmonero::WalletListener {
* @param amount - amount
*/
void unconfirmedMoneyReceived(const std::string &txId, uint64_t amount) {
std::lock_guard<std::mutex> lock(_listenerMutex);
if (jlistener == nullptr) return;
LOGD("unconfirmedMoneyReceived %"
PRIu64, amount);
@@ -160,6 +167,7 @@ struct MyWalletListener : Bitmonero::WalletListener {
* @param height - block height
*/
void newBlock(uint64_t height) {
std::lock_guard<std::mutex> lock(_listenerMutex);
if (jlistener == nullptr) return;
//LOGD("newBlock");
JNIEnv *jenv;
@@ -178,6 +186,7 @@ struct MyWalletListener : Bitmonero::WalletListener {
* @brief refreshed - called when wallet refreshed by background thread or explicitly refreshed by calling "refresh" synchronously
*/
void refreshed() {
std::lock_guard<std::mutex> lock(_listenerMutex);
if (jlistener == nullptr) return;
LOGD("refreshed");
JNIEnv *jenv;
@@ -465,14 +474,15 @@ JNIEXPORT jboolean JNICALL
Java_com_m2049r_xmrwallet_model_WalletManager_closeJ(JNIEnv *env, jobject instance,
jobject walletInstance) {
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, walletInstance);
bool closeSuccess = Bitmonero::WalletManagerFactory::getWalletManager()->closeWallet(wallet, false);
bool closeSuccess = Bitmonero::WalletManagerFactory::getWalletManager()->closeWallet(wallet,
false);
if (closeSuccess) {
MyWalletListener *walletListener = getHandle<MyWalletListener>(env, walletInstance,
"listenerHandle");
if (walletListener != nullptr) {
walletListener->deleteGlobalJavaRef(env);
delete walletListener;
}
delete walletListener;
}
LOGD("wallet closed");
return closeSuccess;
@@ -531,8 +541,7 @@ Java_com_m2049r_xmrwallet_model_Wallet_setPassword(JNIEnv *env, jobject instance
JNIEXPORT jstring JNICALL
Java_com_m2049r_xmrwallet_model_Wallet_getAddressJ(JNIEnv *env, jobject instance) {
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
const char *address = wallet->address().c_str();
return env->NewStringUTF(address);
return env->NewStringUTF(wallet->address().c_str());
}
JNIEXPORT jstring JNICALL
@@ -602,7 +611,8 @@ Java_com_m2049r_xmrwallet_model_Wallet_initJ(JNIEnv *env, jobject instance,
const char *_daemon_username = env->GetStringUTFChars(daemon_username, JNI_FALSE);
const char *_daemon_password = env->GetStringUTFChars(daemon_password, JNI_FALSE);
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
bool status = wallet->init(_daemon_address, upper_transaction_size_limit, _daemon_username, _daemon_password);
bool status = wallet->init(_daemon_address, upper_transaction_size_limit, _daemon_username,
_daemon_password);
env->ReleaseStringUTFChars(daemon_address, _daemon_address);
env->ReleaseStringUTFChars(daemon_username, _daemon_username);
env->ReleaseStringUTFChars(daemon_password, _daemon_password);
@@ -920,7 +930,7 @@ jobject newTransferInstance(JNIEnv *env, uint64_t amount, const std::string &add
jobject newTransferList(JNIEnv *env, Bitmonero::TransactionInfo *info) {
const std::vector<Bitmonero::TransactionInfo::Transfer> &transfers = info->transfers();
if (transfers.size()==0) { // don't create empty Lists
if (transfers.size() == 0) { // don't create empty Lists
return nullptr;
}
// make new ArrayList

View File

@@ -75,13 +75,13 @@ public class LoginActivity extends AppCompatActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "onCreate()");
super.onCreate(savedInstanceState);
setContentView(R.layout.login_activity);
setContentView(R.layout.login_activity);
if (savedInstanceState != null) {
return;
// we don't store anything ourselves
}
setContentView(R.layout.login_activity);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

View File

@@ -186,7 +186,7 @@ public class LoginFragment extends Fragment {
etDaemonAddress.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
if (hasFocus && !getActivity().isFinishing() && etDaemonAddress.isLaidOut()) {
etDaemonAddress.showDropDown();
Helper.showKeyboard(getActivity());
}
@@ -376,7 +376,7 @@ public class LoginFragment extends Fragment {
}
String getDaemon() {
return etDaemonAddress.getText().toString();
return etDaemonAddress.getText().toString().trim();
}
void setDaemon(NodeList nodeList) {

View File

@@ -150,14 +150,16 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
protected void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "onCreate()");
super.onCreate(savedInstanceState);
setContentView(R.layout.wallet_activity);
if (savedInstanceState != null) {
return;
// we don't store anything ourselves
}
setContentView(R.layout.wallet_activity);
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle(R.string.app_name);
setSupportActionBar(toolbar);
toolbar.setTitle(R.string.app_name);
boolean testnet = WalletManager.getInstance().isTestNet();
if (testnet) {
toolbar.setBackgroundResource(R.color.colorPrimaryDark);

View File

@@ -144,7 +144,7 @@ public class LicensesFragment extends DialogFragment {
mWebView = (WebView) content.findViewById(R.id.licensesFragmentWebView);
mIndeterminateProgress = (ProgressBar) content.findViewById(R.id.licensesFragmentIndeterminateProgress);
boolean showCloseButton = false;
boolean showCloseButton = true;
Bundle arguments = getArguments();
if (arguments != null) {
showCloseButton = arguments.getBoolean(KEY_SHOW_CLOSE_BUTTON);

View File

@@ -50,8 +50,6 @@ public class Wallet {
ConnectionStatus_WrongVersion
}
//public native long createWalletListenerJ();
public native String getSeed();
public native String getSeedLanguage();
@@ -68,11 +66,11 @@ public class Wallet {
public native boolean setPassword(String password);
private String address = null;
public String getAddress() {
String address = getAddressJ();
if (!Wallet.isAddressValid(address, WalletManager.getInstance().isTestNet())) {
// just die!
throw new IllegalStateException("Wallet returned invalid address!");
if (address == null) {
address = getAddressJ();
}
return address;
}

View File

@@ -1,107 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="@+id/etWalletName"
style="@style/MoneroEdit"
android:layout_width="0dp"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="@string/generate_name_hint"
android:imeOptions="actionNext"
android:inputType="text"
android:maxLines="1"
android:textAlignment="center" />
android:orientation="horizontal"
android:weightSum="2">
<EditText
android:id="@+id/etWalletName"
style="@style/MoneroEdit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="@string/generate_name_hint"
android:imeOptions="actionNext"
android:inputType="text"
android:maxLines="1"
android:textAlignment="center" />
<EditText
android:id="@+id/etWalletPassword"
style="@style/MoneroEdit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="@string/generate_password_hint"
android:imeOptions="actionNext"
android:inputType="text"
android:textAlignment="center" />
</LinearLayout>
<EditText
android:id="@+id/etWalletPassword"
style="@style/MoneroEdit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="@string/generate_password_hint"
android:imeOptions="actionNext"
android:inputType="text"
android:textAlignment="center" />
</LinearLayout>
<EditText
android:id="@+id/etWalletMnemonic"
style="@style/MoneroEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/generate_mnemonic_hint"
android:imeOptions="actionNext"
android:inputType="textMultiLine"
android:textAlignment="center" />
<EditText
android:id="@+id/etWalletAddress"
style="@style/MoneroEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/generate_address_hint"
android:imeOptions="actionNext"
android:inputType="textMultiLine"
android:textAlignment="center" />
<LinearLayout
android:id="@+id/llRestoreKeys"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<EditText
android:id="@+id/etWalletViewKey"
android:id="@+id/etWalletMnemonic"
style="@style/MoneroEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/generate_viewkey_hint"
android:hint="@string/generate_mnemonic_hint"
android:imeOptions="actionNext"
android:inputType="textMultiLine"
android:textAlignment="center" />
<EditText
android:id="@+id/etWalletSpendKey"
android:id="@+id/etWalletAddress"
style="@style/MoneroEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/generate_spendkey_hint"
android:hint="@string/generate_address_hint"
android:imeOptions="actionNext"
android:inputType="textMultiLine"
android:textAlignment="center"/>
android:textAlignment="center" />
<LinearLayout
android:id="@+id/llRestoreKeys"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<EditText
android:id="@+id/etWalletViewKey"
style="@style/MoneroEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/generate_viewkey_hint"
android:imeOptions="actionNext"
android:inputType="textMultiLine"
android:textAlignment="center" />
<EditText
android:id="@+id/etWalletSpendKey"
style="@style/MoneroEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/generate_spendkey_hint"
android:imeOptions="actionNext"
android:inputType="textMultiLine"
android:textAlignment="center" />
</LinearLayout>
<EditText
android:id="@+id/etWalletRestoreHeight"
style="@style/MoneroEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/generate_restoreheight_hint"
android:imeOptions="actionDone"
android:inputType="number"
android:textAlignment="center"
android:visibility="gone" />
<Button
android:id="@+id/bGenerate"
style="@style/MoneroButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:enabled="false"
android:text="@string/generate_buttonGenerate" />
</LinearLayout>
<EditText
android:id="@+id/etWalletRestoreHeight"
style="@style/MoneroEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/generate_restoreheight_hint"
android:imeOptions="actionDone"
android:inputType="number"
android:textAlignment="center"
android:visibility="gone" />
<Button
android:id="@+id/bGenerate"
style="@style/MoneroButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:enabled="false"
android:text="@string/generate_buttonGenerate" />
</LinearLayout>
</ScrollView>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -27,6 +27,11 @@
- Archive (=Backup and delete)
- 3 Default nodes + History of last 5 used nodes
## After installing from Google Play the wallet list is empty!
Sorry about that. The folder for the wallets was renamed from "Monerujo" to "monerujo".
On most devices this does not matter (they don't care about upper/lower case). Yours does.
If you use a file explorer (e.g. es file explorer) you can find the Monerujo folder and rename it to "monerujo".
## I cannot select and copy the mnemonic seed
Copying anything to the clipboard on Android exposes it to any other App running. So this
is a security measure to keep your seed safe(r).