mirror of
https://github.com/m2049r/xmrwallet
synced 2025-09-15 17:40:50 +02:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0d03b75785 | ||
![]() |
a3db07c6a7 | ||
![]() |
6678222202 | ||
![]() |
793d984200 | ||
![]() |
cc46dc06c4 | ||
![]() |
be236cce1b | ||
![]() |
af18a89a5e |
@@ -8,8 +8,8 @@ android {
|
|||||||
applicationId "com.m2049r.xmrwallet"
|
applicationId "com.m2049r.xmrwallet"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 25
|
targetSdkVersion 25
|
||||||
versionCode 13
|
versionCode 19
|
||||||
versionName "0.8"
|
versionName "0.8.0.6"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
|
@@ -39,6 +39,8 @@ static jclass class_WalletListener;
|
|||||||
static jclass class_TransactionInfo;
|
static jclass class_TransactionInfo;
|
||||||
static jclass class_Transfer;
|
static jclass class_Transfer;
|
||||||
|
|
||||||
|
std::mutex _listenerMutex;
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
|
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
|
||||||
cachedJVM = jvm;
|
cachedJVM = jvm;
|
||||||
LOGI("JNI_OnLoad");
|
LOGI("JNI_OnLoad");
|
||||||
@@ -101,6 +103,7 @@ struct MyWalletListener : Bitmonero::WalletListener {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void deleteGlobalJavaRef(JNIEnv *env) {
|
void deleteGlobalJavaRef(JNIEnv *env) {
|
||||||
|
std::lock_guard<std::mutex> lock(_listenerMutex);
|
||||||
env->DeleteGlobalRef(jlistener);
|
env->DeleteGlobalRef(jlistener);
|
||||||
jlistener = nullptr;
|
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;
|
* @brief updated - generic callback, called when any event (sent/received/block reveived/etc) happened with the wallet;
|
||||||
*/
|
*/
|
||||||
void updated() {
|
void updated() {
|
||||||
|
std::lock_guard<std::mutex> lock(_listenerMutex);
|
||||||
if (jlistener == nullptr) return;
|
if (jlistener == nullptr) return;
|
||||||
LOGD("updated");
|
LOGD("updated");
|
||||||
JNIEnv *jenv;
|
JNIEnv *jenv;
|
||||||
@@ -128,6 +132,7 @@ struct MyWalletListener : Bitmonero::WalletListener {
|
|||||||
* @param amount - amount
|
* @param amount - amount
|
||||||
*/
|
*/
|
||||||
void moneySpent(const std::string &txId, uint64_t amount) {
|
void moneySpent(const std::string &txId, uint64_t amount) {
|
||||||
|
std::lock_guard<std::mutex> lock(_listenerMutex);
|
||||||
if (jlistener == nullptr) return;
|
if (jlistener == nullptr) return;
|
||||||
LOGD("moneySpent %"
|
LOGD("moneySpent %"
|
||||||
PRIu64, amount);
|
PRIu64, amount);
|
||||||
@@ -139,6 +144,7 @@ struct MyWalletListener : Bitmonero::WalletListener {
|
|||||||
* @param amount - amount
|
* @param amount - amount
|
||||||
*/
|
*/
|
||||||
void moneyReceived(const std::string &txId, uint64_t amount) {
|
void moneyReceived(const std::string &txId, uint64_t amount) {
|
||||||
|
std::lock_guard<std::mutex> lock(_listenerMutex);
|
||||||
if (jlistener == nullptr) return;
|
if (jlistener == nullptr) return;
|
||||||
LOGD("moneyReceived %"
|
LOGD("moneyReceived %"
|
||||||
PRIu64, amount);
|
PRIu64, amount);
|
||||||
@@ -150,6 +156,7 @@ struct MyWalletListener : Bitmonero::WalletListener {
|
|||||||
* @param amount - amount
|
* @param amount - amount
|
||||||
*/
|
*/
|
||||||
void unconfirmedMoneyReceived(const std::string &txId, uint64_t amount) {
|
void unconfirmedMoneyReceived(const std::string &txId, uint64_t amount) {
|
||||||
|
std::lock_guard<std::mutex> lock(_listenerMutex);
|
||||||
if (jlistener == nullptr) return;
|
if (jlistener == nullptr) return;
|
||||||
LOGD("unconfirmedMoneyReceived %"
|
LOGD("unconfirmedMoneyReceived %"
|
||||||
PRIu64, amount);
|
PRIu64, amount);
|
||||||
@@ -160,6 +167,7 @@ struct MyWalletListener : Bitmonero::WalletListener {
|
|||||||
* @param height - block height
|
* @param height - block height
|
||||||
*/
|
*/
|
||||||
void newBlock(uint64_t height) {
|
void newBlock(uint64_t height) {
|
||||||
|
std::lock_guard<std::mutex> lock(_listenerMutex);
|
||||||
if (jlistener == nullptr) return;
|
if (jlistener == nullptr) return;
|
||||||
//LOGD("newBlock");
|
//LOGD("newBlock");
|
||||||
JNIEnv *jenv;
|
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
|
* @brief refreshed - called when wallet refreshed by background thread or explicitly refreshed by calling "refresh" synchronously
|
||||||
*/
|
*/
|
||||||
void refreshed() {
|
void refreshed() {
|
||||||
|
std::lock_guard<std::mutex> lock(_listenerMutex);
|
||||||
if (jlistener == nullptr) return;
|
if (jlistener == nullptr) return;
|
||||||
LOGD("refreshed");
|
LOGD("refreshed");
|
||||||
JNIEnv *jenv;
|
JNIEnv *jenv;
|
||||||
@@ -465,15 +474,16 @@ JNIEXPORT jboolean JNICALL
|
|||||||
Java_com_m2049r_xmrwallet_model_WalletManager_closeJ(JNIEnv *env, jobject instance,
|
Java_com_m2049r_xmrwallet_model_WalletManager_closeJ(JNIEnv *env, jobject instance,
|
||||||
jobject walletInstance) {
|
jobject walletInstance) {
|
||||||
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, 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) {
|
if (closeSuccess) {
|
||||||
MyWalletListener *walletListener = getHandle<MyWalletListener>(env, walletInstance,
|
MyWalletListener *walletListener = getHandle<MyWalletListener>(env, walletInstance,
|
||||||
"listenerHandle");
|
"listenerHandle");
|
||||||
if (walletListener != nullptr) {
|
if (walletListener != nullptr) {
|
||||||
walletListener->deleteGlobalJavaRef(env);
|
walletListener->deleteGlobalJavaRef(env);
|
||||||
}
|
|
||||||
delete walletListener;
|
delete walletListener;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
LOGD("wallet closed");
|
LOGD("wallet closed");
|
||||||
return closeSuccess;
|
return closeSuccess;
|
||||||
}
|
}
|
||||||
@@ -531,8 +541,7 @@ Java_com_m2049r_xmrwallet_model_Wallet_setPassword(JNIEnv *env, jobject instance
|
|||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
Java_com_m2049r_xmrwallet_model_Wallet_getAddressJ(JNIEnv *env, jobject instance) {
|
Java_com_m2049r_xmrwallet_model_Wallet_getAddressJ(JNIEnv *env, jobject instance) {
|
||||||
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
||||||
const char *address = wallet->address().c_str();
|
return env->NewStringUTF(wallet->address().c_str());
|
||||||
return env->NewStringUTF(address);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL
|
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_username = env->GetStringUTFChars(daemon_username, JNI_FALSE);
|
||||||
const char *_daemon_password = env->GetStringUTFChars(daemon_password, JNI_FALSE);
|
const char *_daemon_password = env->GetStringUTFChars(daemon_password, JNI_FALSE);
|
||||||
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
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_address, _daemon_address);
|
||||||
env->ReleaseStringUTFChars(daemon_username, _daemon_username);
|
env->ReleaseStringUTFChars(daemon_username, _daemon_username);
|
||||||
env->ReleaseStringUTFChars(daemon_password, _daemon_password);
|
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) {
|
jobject newTransferList(JNIEnv *env, Bitmonero::TransactionInfo *info) {
|
||||||
const std::vector<Bitmonero::TransactionInfo::Transfer> &transfers = info->transfers();
|
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;
|
return nullptr;
|
||||||
}
|
}
|
||||||
// make new ArrayList
|
// make new ArrayList
|
||||||
|
@@ -40,7 +40,6 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.ArrayAdapter;
|
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@@ -76,12 +75,13 @@ public class LoginActivity extends AppCompatActivity
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
Log.d(TAG, "onCreate()");
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.login_activity);
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
return;
|
// we don't store anything ourselves
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setContentView(R.layout.login_activity);
|
||||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
@@ -187,13 +187,10 @@ public class LoginActivity extends AppCompatActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class AsyncRename extends AsyncTask<String, Void, Boolean> {
|
private class AsyncRename extends AsyncTask<String, Void, Boolean> {
|
||||||
ProgressDialog progressDialog = new MyProgressDialog(LoginActivity.this, R.string.rename_progress);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPreExecute() {
|
protected void onPreExecute() {
|
||||||
super.onPreExecute();
|
super.onPreExecute();
|
||||||
progressDialog.show();
|
showProgressDialog(R.string.rename_progress);
|
||||||
LoginActivity.this.asyncWaitTask = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -207,13 +204,15 @@ public class LoginActivity extends AppCompatActivity
|
|||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Boolean result) {
|
protected void onPostExecute(Boolean result) {
|
||||||
super.onPostExecute(result);
|
super.onPostExecute(result);
|
||||||
progressDialog.dismiss();
|
if (isDestroyed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dismissProgressDialog();
|
||||||
if (result) {
|
if (result) {
|
||||||
reloadWalletList();
|
reloadWalletList();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(LoginActivity.this, getString(R.string.rename_failed), Toast.LENGTH_LONG).show();
|
Toast.makeText(LoginActivity.this, getString(R.string.rename_failed), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
LoginActivity.this.asyncWaitTask = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,13 +282,10 @@ public class LoginActivity extends AppCompatActivity
|
|||||||
|
|
||||||
|
|
||||||
private class AsyncBackup extends AsyncTask<String, Void, Boolean> {
|
private class AsyncBackup extends AsyncTask<String, Void, Boolean> {
|
||||||
ProgressDialog progressDialog = new MyProgressDialog(LoginActivity.this, R.string.backup_progress);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPreExecute() {
|
protected void onPreExecute() {
|
||||||
super.onPreExecute();
|
super.onPreExecute();
|
||||||
progressDialog.show();
|
showProgressDialog(R.string.backup_progress);
|
||||||
LoginActivity.this.asyncWaitTask = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -301,11 +297,13 @@ public class LoginActivity extends AppCompatActivity
|
|||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Boolean result) {
|
protected void onPostExecute(Boolean result) {
|
||||||
super.onPostExecute(result);
|
super.onPostExecute(result);
|
||||||
progressDialog.dismiss();
|
if (isDestroyed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dismissProgressDialog();
|
||||||
if (!result) {
|
if (!result) {
|
||||||
Toast.makeText(LoginActivity.this, getString(R.string.backup_failed), Toast.LENGTH_LONG).show();
|
Toast.makeText(LoginActivity.this, getString(R.string.backup_failed), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
LoginActivity.this.asyncWaitTask = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,13 +333,10 @@ public class LoginActivity extends AppCompatActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class AsyncArchive extends AsyncTask<String, Void, Boolean> {
|
private class AsyncArchive extends AsyncTask<String, Void, Boolean> {
|
||||||
ProgressDialog progressDialog = new MyProgressDialog(LoginActivity.this, R.string.archive_progress);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPreExecute() {
|
protected void onPreExecute() {
|
||||||
super.onPreExecute();
|
super.onPreExecute();
|
||||||
progressDialog.show();
|
showProgressDialog(R.string.archive_progress);
|
||||||
LoginActivity.this.asyncWaitTask = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -358,13 +353,15 @@ public class LoginActivity extends AppCompatActivity
|
|||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Boolean result) {
|
protected void onPostExecute(Boolean result) {
|
||||||
super.onPostExecute(result);
|
super.onPostExecute(result);
|
||||||
progressDialog.dismiss();
|
if (isDestroyed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dismissProgressDialog();
|
||||||
if (result) {
|
if (result) {
|
||||||
reloadWalletList();
|
reloadWalletList();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(LoginActivity.this, getString(R.string.archive_failed), Toast.LENGTH_LONG).show();
|
Toast.makeText(LoginActivity.this, getString(R.string.archive_failed), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
LoginActivity.this.asyncWaitTask = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -530,7 +527,26 @@ public class LoginActivity extends AppCompatActivity
|
|||||||
super.onPause();
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
AsyncTask asyncWaitTask = null; // TODO should this really be set from all AsyncTasks here?
|
ProgressDialog progressDialog = null;
|
||||||
|
|
||||||
|
private void showProgressDialog(int msgId) {
|
||||||
|
dismissProgressDialog(); // just in case
|
||||||
|
progressDialog = new MyProgressDialog(LoginActivity.this, msgId);
|
||||||
|
progressDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dismissProgressDialog() {
|
||||||
|
if (progressDialog != null && progressDialog.isShowing()) {
|
||||||
|
progressDialog.dismiss();
|
||||||
|
}
|
||||||
|
progressDialog = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
dismissProgressDialog();
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
@@ -538,7 +554,7 @@ public class LoginActivity extends AppCompatActivity
|
|||||||
Log.d(TAG, "onResume()");
|
Log.d(TAG, "onResume()");
|
||||||
setTitle(getString(R.string.login_activity_name));
|
setTitle(getString(R.string.login_activity_name));
|
||||||
// wait for WalletService to finish
|
// wait for WalletService to finish
|
||||||
if (WalletService.Running && (asyncWaitTask == null)) {
|
if (WalletService.Running && (progressDialog == null)) {
|
||||||
// and show a progress dialog, but only if there isn't one already
|
// and show a progress dialog, but only if there isn't one already
|
||||||
new AsyncWaitForService().execute();
|
new AsyncWaitForService().execute();
|
||||||
}
|
}
|
||||||
@@ -562,13 +578,10 @@ public class LoginActivity extends AppCompatActivity
|
|||||||
|
|
||||||
|
|
||||||
private class AsyncWaitForService extends AsyncTask<Void, Void, Void> {
|
private class AsyncWaitForService extends AsyncTask<Void, Void, Void> {
|
||||||
ProgressDialog progressDialog = new MyProgressDialog(LoginActivity.this, R.string.service_progress);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPreExecute() {
|
protected void onPreExecute() {
|
||||||
super.onPreExecute();
|
super.onPreExecute();
|
||||||
progressDialog.show();
|
showProgressDialog(R.string.service_progress);
|
||||||
LoginActivity.this.asyncWaitTask = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -586,12 +599,13 @@ public class LoginActivity extends AppCompatActivity
|
|||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Void result) {
|
protected void onPostExecute(Void result) {
|
||||||
super.onPostExecute(result);
|
super.onPostExecute(result);
|
||||||
progressDialog.dismiss();
|
if (isDestroyed()) {
|
||||||
LoginActivity.this.asyncWaitTask = null;
|
return;
|
||||||
|
}
|
||||||
|
dismissProgressDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void startWallet(String walletName, String walletPassword) {
|
void startWallet(String walletName, String walletPassword) {
|
||||||
Log.d(TAG, "startWallet()");
|
Log.d(TAG, "startWallet()");
|
||||||
Intent intent = new Intent(getApplicationContext(), WalletActivity.class);
|
Intent intent = new Intent(getApplicationContext(), WalletActivity.class);
|
||||||
@@ -707,6 +721,7 @@ public class LoginActivity extends AppCompatActivity
|
|||||||
@Override
|
@Override
|
||||||
protected void onPreExecute() {
|
protected void onPreExecute() {
|
||||||
super.onPreExecute();
|
super.onPreExecute();
|
||||||
|
showProgressDialog(R.string.generate_wallet_creating);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -747,6 +762,10 @@ public class LoginActivity extends AppCompatActivity
|
|||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Boolean result) {
|
protected void onPostExecute(Boolean result) {
|
||||||
super.onPostExecute(result);
|
super.onPostExecute(result);
|
||||||
|
if (isDestroyed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dismissProgressDialog();
|
||||||
if (result) {
|
if (result) {
|
||||||
startDetails(newWalletFile, walletPassword, GenerateReviewFragment.VIEW_TYPE_ACCEPT);
|
startDetails(newWalletFile, walletPassword, GenerateReviewFragment.VIEW_TYPE_ACCEPT);
|
||||||
} else {
|
} else {
|
||||||
@@ -754,7 +773,6 @@ public class LoginActivity extends AppCompatActivity
|
|||||||
getString(R.string.generate_wallet_create_failed), Toast.LENGTH_LONG).show();
|
getString(R.string.generate_wallet_create_failed), Toast.LENGTH_LONG).show();
|
||||||
walletGenerateError();
|
walletGenerateError();
|
||||||
}
|
}
|
||||||
LoginActivity.this.asyncWaitTask = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -186,7 +186,7 @@ public class LoginFragment extends Fragment {
|
|||||||
etDaemonAddress.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
etDaemonAddress.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onFocusChange(View v, boolean hasFocus) {
|
public void onFocusChange(View v, boolean hasFocus) {
|
||||||
if (hasFocus) {
|
if (hasFocus && !getActivity().isFinishing()) {
|
||||||
etDaemonAddress.showDropDown();
|
etDaemonAddress.showDropDown();
|
||||||
Helper.showKeyboard(getActivity());
|
Helper.showKeyboard(getActivity());
|
||||||
}
|
}
|
||||||
|
@@ -150,14 +150,16 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
Log.d(TAG, "onCreate()");
|
Log.d(TAG, "onCreate()");
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.wallet_activity);
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
return;
|
// we don't store anything ourselves
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setContentView(R.layout.wallet_activity);
|
||||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
toolbar.setTitle(R.string.app_name);
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
|
toolbar.setTitle(R.string.app_name);
|
||||||
|
|
||||||
boolean testnet = WalletManager.getInstance().isTestNet();
|
boolean testnet = WalletManager.getInstance().isTestNet();
|
||||||
if (testnet) {
|
if (testnet) {
|
||||||
toolbar.setBackgroundResource(R.color.colorPrimaryDark);
|
toolbar.setBackgroundResource(R.color.colorPrimaryDark);
|
||||||
|
@@ -144,7 +144,7 @@ public class LicensesFragment extends DialogFragment {
|
|||||||
mWebView = (WebView) content.findViewById(R.id.licensesFragmentWebView);
|
mWebView = (WebView) content.findViewById(R.id.licensesFragmentWebView);
|
||||||
mIndeterminateProgress = (ProgressBar) content.findViewById(R.id.licensesFragmentIndeterminateProgress);
|
mIndeterminateProgress = (ProgressBar) content.findViewById(R.id.licensesFragmentIndeterminateProgress);
|
||||||
|
|
||||||
boolean showCloseButton = false;
|
boolean showCloseButton = true;
|
||||||
Bundle arguments = getArguments();
|
Bundle arguments = getArguments();
|
||||||
if (arguments != null) {
|
if (arguments != null) {
|
||||||
showCloseButton = arguments.getBoolean(KEY_SHOW_CLOSE_BUTTON);
|
showCloseButton = arguments.getBoolean(KEY_SHOW_CLOSE_BUTTON);
|
||||||
|
@@ -50,8 +50,6 @@ public class Wallet {
|
|||||||
ConnectionStatus_WrongVersion
|
ConnectionStatus_WrongVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
//public native long createWalletListenerJ();
|
|
||||||
|
|
||||||
public native String getSeed();
|
public native String getSeed();
|
||||||
|
|
||||||
public native String getSeedLanguage();
|
public native String getSeedLanguage();
|
||||||
@@ -68,11 +66,11 @@ public class Wallet {
|
|||||||
|
|
||||||
public native boolean setPassword(String password);
|
public native boolean setPassword(String password);
|
||||||
|
|
||||||
|
private String address = null;
|
||||||
|
|
||||||
public String getAddress() {
|
public String getAddress() {
|
||||||
String address = getAddressJ();
|
if (address == null) {
|
||||||
if (!Wallet.isAddressValid(address, WalletManager.getInstance().isTestNet())) {
|
address = getAddressJ();
|
||||||
// just die!
|
|
||||||
throw new IllegalStateException("Wallet returned invalid address!");
|
|
||||||
}
|
}
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@@ -80,7 +84,7 @@
|
|||||||
android:hint="@string/generate_spendkey_hint"
|
android:hint="@string/generate_spendkey_hint"
|
||||||
android:imeOptions="actionNext"
|
android:imeOptions="actionNext"
|
||||||
android:inputType="textMultiLine"
|
android:inputType="textMultiLine"
|
||||||
android:textAlignment="center"/>
|
android:textAlignment="center" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
@@ -104,4 +108,5 @@
|
|||||||
android:enabled="false"
|
android:enabled="false"
|
||||||
android:text="@string/generate_buttonGenerate" />
|
android:text="@string/generate_buttonGenerate" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
@@ -1,5 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@@ -138,4 +142,5 @@
|
|||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:text="@string/generate_button_accept"
|
android:text="@string/generate_button_accept"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
@@ -6,7 +6,6 @@
|
|||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/toolbar"
|
|
||||||
layout="@layout/toolbar" />
|
layout="@layout/toolbar" />
|
||||||
|
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/toolbar"
|
|
||||||
layout="@layout/toolbar" />
|
layout="@layout/toolbar" />
|
||||||
|
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
File diff suppressed because one or more lines are too long
@@ -97,6 +97,7 @@
|
|||||||
|
|
||||||
<string name="generate_wallet_exists">Wallet exists! Choose another name</string>
|
<string name="generate_wallet_exists">Wallet exists! Choose another name</string>
|
||||||
<string name="generate_wallet_dot">Wallet name may not begin with \'.\'</string>
|
<string name="generate_wallet_dot">Wallet name may not begin with \'.\'</string>
|
||||||
|
<string name="generate_wallet_creating">Creating wallet</string>
|
||||||
<string name="generate_wallet_created">Wallet created</string>
|
<string name="generate_wallet_created">Wallet created</string>
|
||||||
<string name="generate_wallet_create_failed">Wallet create failed</string>
|
<string name="generate_wallet_create_failed">Wallet create failed</string>
|
||||||
<string name="generate_wallet_create_failed_1">Wallet create failed (1/2)</string>
|
<string name="generate_wallet_create_failed_1">Wallet create failed (1/2)</string>
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user