diff --git a/app/build.gradle b/app/build.gradle index d0a81e1..cadca62 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "net.mynero.wallet" minSdkVersion 21 targetSdkVersion 34 - versionCode 50600 - versionName "0.5.6 'Fluorine Fermi'" + versionCode 50601 + versionName "0.5.6.1 'Fluorine Fermi'" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" externalNativeBuild { cmake { diff --git a/app/src/main/cpp/monerujo.cpp b/app/src/main/cpp/monerujo.cpp index e4c3fa7..3ff6270 100644 --- a/app/src/main/cpp/monerujo.cpp +++ b/app/src/main/cpp/monerujo.cpp @@ -235,7 +235,7 @@ std::vector java2cpp(JNIEnv *env, jobject arrayList) { jlong getElement(JNIEnv *env, jlongArray arr_j, int element) { jlong result; - env->GetLongArrayRegion(arr_j, element,1, &result); + env->GetLongArrayRegion(arr_j, element, 1, &result); return result; } @@ -326,9 +326,9 @@ extern "C" /**********************************/ JNIEXPORT jlong JNICALL Java_net_mynero_wallet_model_WalletManager_createWalletJ(JNIEnv *env, jobject instance, - jstring path, jstring password, - jstring language, - jint networkType) { + jstring path, jstring password, + jstring language, + jint networkType) { const char *_path = env->GetStringUTFChars(path, nullptr); const char *_password = env->GetStringUTFChars(password, nullptr); const char *_language = env->GetStringUTFChars(language, nullptr); @@ -349,9 +349,10 @@ Java_net_mynero_wallet_model_WalletManager_createWalletJ(JNIEnv *env, jobject in JNIEXPORT jlong JNICALL Java_net_mynero_wallet_model_WalletManager_createWalletPolyseedJ(JNIEnv *env, jobject instance, - jstring path, jstring password, jstring passpharse, - jstring language, - jint networkType) { + jstring path, jstring password, + jstring passpharse, + jstring language, + jint networkType) { std::string seed_words; std::string err; bool _polyseedCreate = Monero::Wallet::createPolyseed(seed_words, err); @@ -384,8 +385,8 @@ Java_net_mynero_wallet_model_WalletManager_createWalletPolyseedJ(JNIEnv *env, jo JNIEXPORT jlong JNICALL Java_net_mynero_wallet_model_WalletManager_openWalletJ(JNIEnv *env, jobject instance, - jstring path, jstring password, - jint networkType) { + jstring path, jstring password, + jint networkType) { const char *_path = env->GetStringUTFChars(path, nullptr); const char *_password = env->GetStringUTFChars(password, nullptr); Monero::NetworkType _networkType = static_cast(networkType); @@ -403,10 +404,10 @@ Java_net_mynero_wallet_model_WalletManager_openWalletJ(JNIEnv *env, jobject inst JNIEXPORT jlong JNICALL Java_net_mynero_wallet_model_WalletManager_recoveryWalletJ(JNIEnv *env, jobject instance, - jstring path, jstring password, - jstring mnemonic, jstring offset, - jint networkType, - jlong restoreHeight) { + jstring path, jstring password, + jstring mnemonic, jstring offset, + jint networkType, + jlong restoreHeight) { const char *_path = env->GetStringUTFChars(path, nullptr); const char *_password = env->GetStringUTFChars(password, nullptr); const char *_mnemonic = env->GetStringUTFChars(mnemonic, nullptr); @@ -432,9 +433,9 @@ Java_net_mynero_wallet_model_WalletManager_recoveryWalletJ(JNIEnv *env, jobject JNIEXPORT jlong JNICALL Java_net_mynero_wallet_model_WalletManager_recoveryWalletPolyseedJ(JNIEnv *env, jobject instance, - jstring path, jstring password, - jstring mnemonic, jstring offset, - jint networkType) { + jstring path, jstring password, + jstring mnemonic, jstring offset, + jint networkType) { const char *_path = env->GetStringUTFChars(path, nullptr); const char *_password = env->GetStringUTFChars(password, nullptr); const char *_mnemonic = env->GetStringUTFChars(mnemonic, nullptr); @@ -459,13 +460,13 @@ Java_net_mynero_wallet_model_WalletManager_recoveryWalletPolyseedJ(JNIEnv *env, JNIEXPORT jlong JNICALL Java_net_mynero_wallet_model_WalletManager_createWalletFromKeysJ(JNIEnv *env, jobject instance, - jstring path, jstring password, - jstring language, - jint networkType, - jlong restoreHeight, - jstring addressString, - jstring viewKeyString, - jstring spendKeyString) { + jstring path, jstring password, + jstring language, + jint networkType, + jlong restoreHeight, + jstring addressString, + jstring viewKeyString, + jstring spendKeyString) { const char *_path = env->GetStringUTFChars(path, nullptr); const char *_password = env->GetStringUTFChars(password, nullptr); const char *_language = env->GetStringUTFChars(language, nullptr); @@ -499,12 +500,12 @@ Java_net_mynero_wallet_model_WalletManager_createWalletFromKeysJ(JNIEnv *env, jo JNIEXPORT jlong JNICALL Java_net_mynero_wallet_model_WalletManager_createWalletFromDeviceJ(JNIEnv *env, jobject instance, - jstring path, - jstring password, - jint networkType, - jstring deviceName, - jlong restoreHeight, - jstring subaddressLookahead) { + jstring path, + jstring password, + jint networkType, + jstring deviceName, + jlong restoreHeight, + jstring subaddressLookahead) { const char *_path = env->GetStringUTFChars(path, nullptr); const char *_password = env->GetStringUTFChars(password, nullptr); Monero::NetworkType _networkType = static_cast(networkType); @@ -529,7 +530,7 @@ Java_net_mynero_wallet_model_WalletManager_createWalletFromDeviceJ(JNIEnv *env, JNIEXPORT jboolean JNICALL Java_net_mynero_wallet_model_WalletManager_walletExists(JNIEnv *env, jobject instance, - jstring path) { + jstring path) { const char *_path = env->GetStringUTFChars(path, nullptr); bool exists = Monero::WalletManagerFactory::getWalletManager()->walletExists(std::string(_path)); @@ -539,9 +540,9 @@ Java_net_mynero_wallet_model_WalletManager_walletExists(JNIEnv *env, jobject ins JNIEXPORT jboolean JNICALL Java_net_mynero_wallet_model_WalletManager_verifyWalletPassword(JNIEnv *env, jobject instance, - jstring keys_file_name, - jstring password, - jboolean watch_only) { + jstring keys_file_name, + jstring password, + jboolean watch_only) { const char *_keys_file_name = env->GetStringUTFChars(keys_file_name, nullptr); const char *_password = env->GetStringUTFChars(password, nullptr); bool passwordOk = @@ -555,8 +556,8 @@ Java_net_mynero_wallet_model_WalletManager_verifyWalletPassword(JNIEnv *env, job //virtual int queryWalletHardware(const std::string &keys_file_name, const std::string &password) const = 0; JNIEXPORT jint JNICALL Java_net_mynero_wallet_model_WalletManager_queryWalletDeviceJ(JNIEnv *env, jobject instance, - jstring keys_file_name, - jstring password) { + jstring keys_file_name, + jstring password) { const char *_keys_file_name = env->GetStringUTFChars(keys_file_name, nullptr); const char *_password = env->GetStringUTFChars(password, nullptr); Monero::Wallet::Device device_type; @@ -572,7 +573,7 @@ Java_net_mynero_wallet_model_WalletManager_queryWalletDeviceJ(JNIEnv *env, jobje JNIEXPORT jobject JNICALL Java_net_mynero_wallet_model_WalletManager_findWallets(JNIEnv *env, jobject instance, - jstring path) { + jstring path) { const char *_path = env->GetStringUTFChars(path, nullptr); std::vector walletPaths = Monero::WalletManagerFactory::getWalletManager()->findWallets(std::string(_path)); @@ -584,7 +585,7 @@ Java_net_mynero_wallet_model_WalletManager_findWallets(JNIEnv *env, jobject inst JNIEXPORT void JNICALL Java_net_mynero_wallet_model_WalletManager_setDaemonAddressJ(JNIEnv *env, jobject instance, - jstring address) { + jstring address) { const char *_address = env->GetStringUTFChars(address, nullptr); Monero::WalletManagerFactory::getWalletManager()->setDaemonAddress(std::string(_address)); env->ReleaseStringUTFChars(address, _address); @@ -593,7 +594,7 @@ Java_net_mynero_wallet_model_WalletManager_setDaemonAddressJ(JNIEnv *env, jobjec // returns whether the daemon can be reached, and its version number JNIEXPORT jint JNICALL Java_net_mynero_wallet_model_WalletManager_getDaemonVersion(JNIEnv *env, - jobject instance) { + jobject instance) { uint32_t version; bool isConnected = Monero::WalletManagerFactory::getWalletManager()->connected(&version); @@ -608,7 +609,7 @@ Java_net_mynero_wallet_model_WalletManager_getBlockchainHeight(JNIEnv *env, jobj JNIEXPORT jlong JNICALL Java_net_mynero_wallet_model_WalletManager_getBlockchainTargetHeight(JNIEnv *env, - jobject instance) { + jobject instance) { return Monero::WalletManagerFactory::getWalletManager()->blockchainTargetHeight(); } @@ -634,9 +635,9 @@ Java_net_mynero_wallet_model_WalletManager_isMining(JNIEnv *env, jobject instanc JNIEXPORT jboolean JNICALL Java_net_mynero_wallet_model_WalletManager_startMining(JNIEnv *env, jobject instance, - jstring address, - jboolean background_mining, - jboolean ignore_battery) { + jstring address, + jboolean background_mining, + jboolean ignore_battery) { const char *_address = env->GetStringUTFChars(address, nullptr); bool success = Monero::WalletManagerFactory::getWalletManager()->startMining(std::string(_address), @@ -653,8 +654,8 @@ Java_net_mynero_wallet_model_WalletManager_stopMining(JNIEnv *env, jobject insta JNIEXPORT jstring JNICALL Java_net_mynero_wallet_model_WalletManager_resolveOpenAlias(JNIEnv *env, jobject instance, - jstring address, - jboolean dnssec_valid) { + jstring address, + jboolean dnssec_valid) { const char *_address = env->GetStringUTFChars(address, nullptr); bool _dnssec_valid = (bool) dnssec_valid; std::string resolvedAlias = @@ -667,7 +668,7 @@ Java_net_mynero_wallet_model_WalletManager_resolveOpenAlias(JNIEnv *env, jobject JNIEXPORT jboolean JNICALL Java_net_mynero_wallet_model_WalletManager_setProxyJ(JNIEnv *env, jobject instance, - jstring address) { + jstring address) { const char *_address = env->GetStringUTFChars(address, nullptr); bool rc = Monero::WalletManagerFactory::getWalletManager()->setProxy(std::string(_address)); @@ -680,7 +681,7 @@ Java_net_mynero_wallet_model_WalletManager_setProxyJ(JNIEnv *env, jobject instan JNIEXPORT jboolean JNICALL Java_net_mynero_wallet_model_WalletManager_closeJ(JNIEnv *env, jobject instance, - jobject walletInstance) { + jobject walletInstance) { Monero::Wallet *wallet = getHandle(env, walletInstance); bool closeSuccess = Monero::WalletManagerFactory::getWalletManager()->closeWallet(wallet, false); @@ -728,7 +729,8 @@ Java_net_mynero_wallet_model_Wallet_getSeed(JNIEnv *env, jobject instance, jstri } JNIEXPORT jstring JNICALL -Java_net_mynero_wallet_model_Wallet_getLegacySeed(JNIEnv *env, jobject instance, jstring seedOffset) { +Java_net_mynero_wallet_model_Wallet_getLegacySeed(JNIEnv *env, jobject instance, + jstring seedOffset) { const char *_seedOffset = env->GetStringUTFChars(seedOffset, nullptr); Monero::Wallet *wallet = getHandle(env, instance); @@ -743,7 +745,8 @@ Java_net_mynero_wallet_model_Wallet_getLegacySeed(JNIEnv *env, jobject instance, } JNIEXPORT jboolean JNICALL -Java_net_mynero_wallet_model_Wallet_isPolyseedSupported(JNIEnv *env, jobject instance, jstring seedOffset) { +Java_net_mynero_wallet_model_Wallet_isPolyseedSupported(JNIEnv *env, jobject instance, + jstring seedOffset) { const char *_seedOffset = env->GetStringUTFChars(seedOffset, nullptr); Monero::Wallet *wallet = getHandle(env, instance); @@ -764,7 +767,7 @@ Java_net_mynero_wallet_model_Wallet_getSeedLanguage(JNIEnv *env, jobject instanc JNIEXPORT void JNICALL Java_net_mynero_wallet_model_Wallet_setSeedLanguage(JNIEnv *env, jobject instance, - jstring language) { + jstring language) { const char *_language = env->GetStringUTFChars(language, nullptr); Monero::Wallet *wallet = getHandle(env, instance); wallet->setSeedLanguage(std::string(_language)); @@ -800,7 +803,7 @@ Java_net_mynero_wallet_model_Wallet_statusWithErrorString(JNIEnv *env, jobject i JNIEXPORT jboolean JNICALL Java_net_mynero_wallet_model_Wallet_setPassword(JNIEnv *env, jobject instance, - jstring password) { + jstring password) { const char *_password = env->GetStringUTFChars(password, nullptr); Monero::Wallet *wallet = getHandle(env, instance); bool success = wallet->setPassword(std::string(_password)); @@ -810,8 +813,8 @@ Java_net_mynero_wallet_model_Wallet_setPassword(JNIEnv *env, jobject instance, JNIEXPORT jstring JNICALL Java_net_mynero_wallet_model_Wallet_getAddressJ(JNIEnv *env, jobject instance, - jint accountIndex, - jint addressIndex) { + jint accountIndex, + jint addressIndex) { Monero::Wallet *wallet = getHandle(env, instance); return env->NewStringUTF( wallet->address((uint32_t) accountIndex, (uint32_t) addressIndex).c_str()); @@ -834,7 +837,7 @@ Java_net_mynero_wallet_model_Wallet_nettype(JNIEnv *env, jobject instance) { JNIEXPORT jstring JNICALL Java_net_mynero_wallet_model_Wallet_getIntegratedAddress(JNIEnv *env, jobject instance, - jstring payment_id) { + jstring payment_id) { const char *_payment_id = env->GetStringUTFChars(payment_id, nullptr); Monero::Wallet *wallet = getHandle(env, instance); std::string address = wallet->integratedAddress(_payment_id); @@ -856,7 +859,7 @@ Java_net_mynero_wallet_model_Wallet_getSecretSpendKey(JNIEnv *env, jobject insta JNIEXPORT jboolean JNICALL Java_net_mynero_wallet_model_Wallet_store(JNIEnv *env, jobject instance, - jstring path) { + jstring path) { const char *_path = env->GetStringUTFChars(path, nullptr); Monero::Wallet *wallet = getHandle(env, instance); bool success = wallet->store(std::string(_path)); @@ -877,10 +880,10 @@ Java_net_mynero_wallet_model_Wallet_getFilename(JNIEnv *env, jobject instance) { JNIEXPORT jboolean JNICALL Java_net_mynero_wallet_model_Wallet_initJ(JNIEnv *env, jobject instance, - jstring daemon_address, - jlong upper_transaction_size_limit, - jstring daemon_username, jstring daemon_password, - jstring proxy) { + jstring daemon_address, + jlong upper_transaction_size_limit, + jstring daemon_username, jstring daemon_password, + jstring proxy) { const char *_daemon_address = env->GetStringUTFChars(daemon_address, nullptr); const char *_daemon_username = env->GetStringUTFChars(daemon_username, nullptr); const char *_daemon_password = env->GetStringUTFChars(daemon_password, nullptr); @@ -901,7 +904,7 @@ Java_net_mynero_wallet_model_Wallet_initJ(JNIEnv *env, jobject instance, JNIEXPORT void JNICALL Java_net_mynero_wallet_model_Wallet_setRestoreHeight(JNIEnv *env, jobject instance, - jlong height) { + jlong height) { Monero::Wallet *wallet = getHandle(env, instance); wallet->setRefreshFromBlockHeight((uint64_t) height); } @@ -921,7 +924,8 @@ Java_net_mynero_wallet_model_Wallet_getConnectionStatusJ(JNIEnv *env, jobject in return wallet->connected(); } JNIEXPORT void JNICALL -Java_net_mynero_wallet_model_Wallet_setTrustedDaemonJ(JNIEnv *env, jobject instance, jboolean trusted) { +Java_net_mynero_wallet_model_Wallet_setTrustedDaemonJ(JNIEnv *env, jobject instance, + jboolean trusted) { Monero::Wallet *wallet = getHandle(env, instance); if (trusted) { wallet->setTrustedDaemon(true); @@ -939,7 +943,7 @@ Java_net_mynero_wallet_model_Wallet_isTrustedDaemonJ(JNIEnv *env, jobject instan JNIEXPORT jboolean JNICALL Java_net_mynero_wallet_model_Wallet_setProxyJ(JNIEnv *env, jobject instance, - jstring address) { + jstring address) { const char *_address = env->GetStringUTFChars(address, nullptr); Monero::Wallet *wallet = getHandle(env, instance); bool rc = wallet->setProxy(std::string(_address)); @@ -949,7 +953,7 @@ Java_net_mynero_wallet_model_Wallet_setProxyJ(JNIEnv *env, jobject instance, JNIEXPORT jlong JNICALL Java_net_mynero_wallet_model_Wallet_getBalance(JNIEnv *env, jobject instance, - jint accountIndex) { + jint accountIndex) { Monero::Wallet *wallet = getHandle(env, instance); return wallet->balance((uint32_t) accountIndex); } @@ -962,7 +966,7 @@ Java_net_mynero_wallet_model_Wallet_getBalanceAll(JNIEnv *env, jobject instance) JNIEXPORT jlong JNICALL Java_net_mynero_wallet_model_Wallet_getUnlockedBalance(JNIEnv *env, jobject instance, - jint accountIndex) { + jint accountIndex) { Monero::Wallet *wallet = getHandle(env, instance); return wallet->unlockedBalance((uint32_t) accountIndex); } @@ -987,7 +991,7 @@ Java_net_mynero_wallet_model_Wallet_getBlockChainHeightJ(JNIEnv *env, jobject in JNIEXPORT jlong JNICALL Java_net_mynero_wallet_model_Wallet_getApproximateBlockChainHeight(JNIEnv *env, - jobject instance) { + jobject instance) { Monero::Wallet *wallet = getHandle(env, instance); return wallet->approximateBlockChainHeight(); } @@ -1000,7 +1004,7 @@ Java_net_mynero_wallet_model_Wallet_getDaemonBlockChainHeightJ(JNIEnv *env, jobj JNIEXPORT jlong JNICALL Java_net_mynero_wallet_model_Wallet_getDaemonBlockChainTargetHeight(JNIEnv *env, - jobject instance) { + jobject instance) { Monero::Wallet *wallet = getHandle(env, instance); return wallet->daemonBlockChainTargetHeight(); } @@ -1020,13 +1024,13 @@ Java_net_mynero_wallet_model_Wallet_getDeviceTypeJ(JNIEnv *env, jobject instance JNIEXPORT jstring JNICALL Java_net_mynero_wallet_model_Wallet_getDisplayAmount(JNIEnv *env, jclass clazz, - jlong amount) { + jlong amount) { return env->NewStringUTF(Monero::Wallet::displayAmount(amount).c_str()); } JNIEXPORT jlong JNICALL Java_net_mynero_wallet_model_Wallet_getAmountFromString(JNIEnv *env, jclass clazz, - jstring amount) { + jstring amount) { const char *_amount = env->GetStringUTFChars(amount, nullptr); uint64_t x = Monero::Wallet::amountFromString(_amount); env->ReleaseStringUTFChars(amount, _amount); @@ -1035,7 +1039,7 @@ Java_net_mynero_wallet_model_Wallet_getAmountFromString(JNIEnv *env, jclass claz JNIEXPORT jlong JNICALL Java_net_mynero_wallet_model_Wallet_getAmountFromDouble(JNIEnv *env, jclass clazz, - jdouble amount) { + jdouble amount) { return Monero::Wallet::amountFromDouble(amount); } @@ -1046,7 +1050,7 @@ Java_net_mynero_wallet_model_Wallet_generatePaymentId(JNIEnv *env, jclass clazz) JNIEXPORT jboolean JNICALL Java_net_mynero_wallet_model_Wallet_isPaymentIdValid(JNIEnv *env, jclass clazz, - jstring payment_id) { + jstring payment_id) { const char *_payment_id = env->GetStringUTFChars(payment_id, nullptr); bool isValid = Monero::Wallet::paymentIdValid(_payment_id); env->ReleaseStringUTFChars(payment_id, _payment_id); @@ -1055,7 +1059,7 @@ Java_net_mynero_wallet_model_Wallet_isPaymentIdValid(JNIEnv *env, jclass clazz, JNIEXPORT jboolean JNICALL Java_net_mynero_wallet_model_Wallet_isAddressValid(JNIEnv *env, jclass clazz, - jstring address, jint networkType) { + jstring address, jint networkType) { const char *_address = env->GetStringUTFChars(address, nullptr); Monero::NetworkType _networkType = static_cast(networkType); bool isValid = Monero::Wallet::addressValid(_address, _networkType); @@ -1065,8 +1069,8 @@ Java_net_mynero_wallet_model_Wallet_isAddressValid(JNIEnv *env, jclass clazz, JNIEXPORT jstring JNICALL Java_net_mynero_wallet_model_Wallet_getPaymentIdFromAddress(JNIEnv *env, jclass clazz, - jstring address, - jint networkType) { + jstring address, + jint networkType) { Monero::NetworkType _networkType = static_cast(networkType); const char *_address = env->GetStringUTFChars(address, nullptr); std::string payment_id = Monero::Wallet::paymentIdFromAddress(_address, _networkType); @@ -1118,10 +1122,10 @@ Java_net_mynero_wallet_model_Wallet_rescanBlockchainAsyncJ(JNIEnv *env, jobject JNIEXPORT jlong JNICALL Java_net_mynero_wallet_model_Wallet_createTransactionJ(JNIEnv *env, jobject instance, - jstring dst_addr, jstring payment_id, - jlong amount, jint mixin_count, - jint priority, - jint accountIndex, jobject key_images) { + jstring dst_addr, jstring payment_id, + jlong amount, jint mixin_count, + jint priority, + jint accountIndex, jobject key_images) { const std::set _key_images = java2cpp_set(env, key_images); const char *_dst_addr = env->GetStringUTFChars(dst_addr, nullptr); const char *_payment_id = env->GetStringUTFChars(payment_id, nullptr); @@ -1132,7 +1136,8 @@ Java_net_mynero_wallet_model_Wallet_createTransactionJ(JNIEnv *env, jobject inst Monero::PendingTransaction *tx = wallet->createTransaction(_dst_addr, _payment_id, amount, (uint32_t) mixin_count, _priority, - (uint32_t) accountIndex, {}, _key_images); + (uint32_t) accountIndex, {}, + _key_images); env->ReleaseStringUTFChars(dst_addr, _dst_addr); env->ReleaseStringUTFChars(payment_id, _payment_id); @@ -1141,10 +1146,12 @@ Java_net_mynero_wallet_model_Wallet_createTransactionJ(JNIEnv *env, jobject inst JNIEXPORT jlong JNICALL Java_net_mynero_wallet_model_Wallet_createTransactionMultDestJ(JNIEnv *env, jobject instance, - jobject dst_addrs, jstring payment_id, - jlongArray amounts, jint mixin_count, - jint priority, - jint accountIndex, jobject key_images) { + jobject dst_addrs, + jstring payment_id, + jlongArray amounts, jint mixin_count, + jint priority, + jint accountIndex, + jobject key_images) { const std::set _key_images = java2cpp_set(env, key_images); const std::vector _dst_addrs = java2cpp(env, dst_addrs); const std::vector _dst_amounts = java2cpp_long(env, amounts); @@ -1154,9 +1161,11 @@ Java_net_mynero_wallet_model_Wallet_createTransactionMultDestJ(JNIEnv *env, jobj Monero::Wallet *wallet = getHandle(env, instance); Monero::PendingTransaction *tx = wallet->createTransactionMultDest(_dst_addrs, _payment_id, - _dst_amounts, (uint32_t) mixin_count, - _priority, - (uint32_t) accountIndex, {}, _key_images); + _dst_amounts, + (uint32_t) mixin_count, + _priority, + (uint32_t) accountIndex, {}, + _key_images); env->ReleaseStringUTFChars(payment_id, _payment_id); return reinterpret_cast(tx); @@ -1165,7 +1174,8 @@ Java_net_mynero_wallet_model_Wallet_createTransactionMultDestJ(JNIEnv *env, jobj JNIEXPORT jlong JNICALL Java_net_mynero_wallet_model_Wallet_estimateTransactionFee(JNIEnv *env, jobject instance, jobject destinations, jint priority) { - std::vector> dest_vector = java2cpp_pairvector(env, destinations); + std::vector> dest_vector = java2cpp_pairvector(env, + destinations); Monero::PendingTransaction::Priority _priority = static_cast(priority); Monero::Wallet *wallet = getHandle(env, instance); uint64_t fee = wallet->estimateTransactionFee(dest_vector, _priority); @@ -1174,10 +1184,10 @@ Java_net_mynero_wallet_model_Wallet_estimateTransactionFee(JNIEnv *env, jobject JNIEXPORT jlong JNICALL Java_net_mynero_wallet_model_Wallet_createSweepTransaction(JNIEnv *env, jobject instance, - jstring dst_addr, jstring payment_id, - jint mixin_count, - jint priority, - jint accountIndex, jobject key_images) { + jstring dst_addr, jstring payment_id, + jint mixin_count, + jint priority, + jint accountIndex, jobject key_images) { const std::set _key_images = java2cpp_set(env, key_images); const char *_dst_addr = env->GetStringUTFChars(dst_addr, nullptr); const char *_payment_id = env->GetStringUTFChars(payment_id, nullptr); @@ -1190,7 +1200,8 @@ Java_net_mynero_wallet_model_Wallet_createSweepTransaction(JNIEnv *env, jobject Monero::PendingTransaction *tx = wallet->createTransaction(_dst_addr, _payment_id, empty, (uint32_t) mixin_count, _priority, - (uint32_t) accountIndex, {}, _key_images); + (uint32_t) accountIndex, {}, + _key_images); env->ReleaseStringUTFChars(dst_addr, _dst_addr); env->ReleaseStringUTFChars(payment_id, _payment_id); @@ -1199,7 +1210,7 @@ Java_net_mynero_wallet_model_Wallet_createSweepTransaction(JNIEnv *env, jobject JNIEXPORT jlong JNICALL Java_net_mynero_wallet_model_Wallet_createSweepUnmixableTransactionJ(JNIEnv *env, - jobject instance) { + jobject instance) { Monero::Wallet *wallet = getHandle(env, instance); Monero::PendingTransaction *tx = wallet->createSweepUnmixableTransaction(); return reinterpret_cast(tx); @@ -1210,7 +1221,7 @@ Java_net_mynero_wallet_model_Wallet_createSweepUnmixableTransactionJ(JNIEnv *env JNIEXPORT void JNICALL Java_net_mynero_wallet_model_Wallet_disposeTransaction(JNIEnv *env, jobject instance, - jobject pendingTransaction) { + jobject pendingTransaction) { Monero::Wallet *wallet = getHandle(env, instance); Monero::PendingTransaction *_pendingTransaction = getHandle(env, pendingTransaction); @@ -1281,7 +1292,8 @@ Java_net_mynero_wallet_model_Coins_refreshJ(JNIEnv *env, jobject instance) { } JNIEXPORT void JNICALL -Java_net_mynero_wallet_model_Coins_setFrozen(JNIEnv *env, jobject instance, jstring publicKey, jboolean frozen) { +Java_net_mynero_wallet_model_Coins_setFrozen(JNIEnv *env, jobject instance, jstring publicKey, + jboolean frozen) { Monero::Coins *coins = getHandle(env, instance); const char *_publicKey = env->GetStringUTFChars(publicKey, nullptr); if (frozen) { @@ -1303,7 +1315,7 @@ Java_net_mynero_wallet_model_Wallet_getHistoryJ(JNIEnv *env, jobject instance) { JNIEXPORT jlong JNICALL Java_net_mynero_wallet_model_Wallet_setListenerJ(JNIEnv *env, jobject instance, - jobject javaListener) { + jobject javaListener) { Monero::Wallet *wallet = getHandle(env, instance); wallet->setListener(nullptr); // clear old listener // delete old listener @@ -1337,7 +1349,7 @@ Java_net_mynero_wallet_model_Wallet_setDefaultMixin(JNIEnv *env, jobject instanc JNIEXPORT jboolean JNICALL Java_net_mynero_wallet_model_Wallet_setUserNote(JNIEnv *env, jobject instance, - jstring txid, jstring note) { + jstring txid, jstring note) { const char *_txid = env->GetStringUTFChars(txid, nullptr); const char *_note = env->GetStringUTFChars(note, nullptr); @@ -1354,7 +1366,7 @@ Java_net_mynero_wallet_model_Wallet_setUserNote(JNIEnv *env, jobject instance, JNIEXPORT jstring JNICALL Java_net_mynero_wallet_model_Wallet_getUserNote(JNIEnv *env, jobject instance, - jstring txid) { + jstring txid) { const char *_txid = env->GetStringUTFChars(txid, nullptr); @@ -1368,7 +1380,7 @@ Java_net_mynero_wallet_model_Wallet_getUserNote(JNIEnv *env, jobject instance, JNIEXPORT jstring JNICALL Java_net_mynero_wallet_model_Wallet_getTxKey(JNIEnv *env, jobject instance, - jstring txid) { + jstring txid) { const char *_txid = env->GetStringUTFChars(txid, nullptr); @@ -1383,7 +1395,7 @@ Java_net_mynero_wallet_model_Wallet_getTxKey(JNIEnv *env, jobject instance, //virtual void addSubaddressAccount(const std::string& label) = 0; JNIEXPORT void JNICALL Java_net_mynero_wallet_model_Wallet_addAccount(JNIEnv *env, jobject instance, - jstring label) { + jstring label) { const char *_label = env->GetStringUTFChars(label, nullptr); @@ -1396,7 +1408,7 @@ Java_net_mynero_wallet_model_Wallet_addAccount(JNIEnv *env, jobject instance, //virtual std::string getSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex) const = 0; JNIEXPORT jstring JNICALL Java_net_mynero_wallet_model_Wallet_getSubaddressLabel(JNIEnv *env, jobject instance, - jint accountIndex, jint addressIndex) { + jint accountIndex, jint addressIndex) { Monero::Wallet *wallet = getHandle(env, instance); @@ -1409,8 +1421,8 @@ Java_net_mynero_wallet_model_Wallet_getSubaddressLabel(JNIEnv *env, jobject inst //virtual void setSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label) = 0; JNIEXPORT void JNICALL Java_net_mynero_wallet_model_Wallet_setSubaddressLabel(JNIEnv *env, jobject instance, - jint accountIndex, jint addressIndex, - jstring label) { + jint accountIndex, jint addressIndex, + jstring label) { const char *_label = env->GetStringUTFChars(label, nullptr); @@ -1430,7 +1442,7 @@ Java_net_mynero_wallet_model_Wallet_getNumAccounts(JNIEnv *env, jobject instance //virtual size_t numSubaddresses(uint32_t accountIndex) const = 0; JNIEXPORT jint JNICALL Java_net_mynero_wallet_model_Wallet_getNumSubaddresses(JNIEnv *env, jobject instance, - jint accountIndex) { + jint accountIndex) { Monero::Wallet *wallet = getHandle(env, instance); return static_cast(wallet->numSubaddresses(accountIndex)); } @@ -1438,8 +1450,8 @@ Java_net_mynero_wallet_model_Wallet_getNumSubaddresses(JNIEnv *env, jobject inst //virtual void addSubaddress(uint32_t accountIndex, const std::string &label) = 0; JNIEXPORT void JNICALL Java_net_mynero_wallet_model_Wallet_addSubaddress(JNIEnv *env, jobject instance, - jint accountIndex, - jstring label) { + jint accountIndex, + jstring label) { const char *_label = env->GetStringUTFChars(label, nullptr); Monero::Wallet *wallet = getHandle(env, instance); @@ -1579,7 +1591,7 @@ Java_net_mynero_wallet_model_PendingTransaction_getErrorString(JNIEnv *env, jobj // commit transaction or save to file if filename is provided. JNIEXPORT jboolean JNICALL Java_net_mynero_wallet_model_PendingTransaction_commit(JNIEnv *env, jobject instance, - jstring filename, jboolean overwrite) { + jstring filename, jboolean overwrite) { const char *_filename = env->GetStringUTFChars(filename, nullptr); @@ -1635,8 +1647,8 @@ Java_net_mynero_wallet_model_PendingTransaction_getTxCount(JNIEnv *env, jobject //static void error(const std::string &category, const std::string &str); JNIEXPORT void JNICALL Java_net_mynero_wallet_model_WalletManager_initLogger(JNIEnv *env, jclass clazz, - jstring argv0, - jstring default_log_base_name) { + jstring argv0, + jstring default_log_base_name) { const char *_argv0 = env->GetStringUTFChars(argv0, nullptr); const char *_default_log_base_name = env->GetStringUTFChars(default_log_base_name, nullptr); @@ -1649,7 +1661,7 @@ Java_net_mynero_wallet_model_WalletManager_initLogger(JNIEnv *env, jclass clazz, JNIEXPORT void JNICALL Java_net_mynero_wallet_model_WalletManager_logDebug(JNIEnv *env, jclass clazz, - jstring category, jstring message) { + jstring category, jstring message) { const char *_category = env->GetStringUTFChars(category, nullptr); const char *_message = env->GetStringUTFChars(message, nullptr); @@ -1662,7 +1674,7 @@ Java_net_mynero_wallet_model_WalletManager_logDebug(JNIEnv *env, jclass clazz, JNIEXPORT void JNICALL Java_net_mynero_wallet_model_WalletManager_logInfo(JNIEnv *env, jclass clazz, - jstring category, jstring message) { + jstring category, jstring message) { const char *_category = env->GetStringUTFChars(category, nullptr); const char *_message = env->GetStringUTFChars(message, nullptr); @@ -1675,7 +1687,7 @@ Java_net_mynero_wallet_model_WalletManager_logInfo(JNIEnv *env, jclass clazz, JNIEXPORT void JNICALL Java_net_mynero_wallet_model_WalletManager_logWarning(JNIEnv *env, jclass clazz, - jstring category, jstring message) { + jstring category, jstring message) { const char *_category = env->GetStringUTFChars(category, nullptr); const char *_message = env->GetStringUTFChars(message, nullptr); @@ -1688,7 +1700,7 @@ Java_net_mynero_wallet_model_WalletManager_logWarning(JNIEnv *env, jclass clazz, JNIEXPORT void JNICALL Java_net_mynero_wallet_model_WalletManager_logError(JNIEnv *env, jclass clazz, - jstring category, jstring message) { + jstring category, jstring message) { const char *_category = env->GetStringUTFChars(category, nullptr); const char *_message = env->GetStringUTFChars(message, nullptr); @@ -1701,7 +1713,7 @@ Java_net_mynero_wallet_model_WalletManager_logError(JNIEnv *env, jclass clazz, JNIEXPORT void JNICALL Java_net_mynero_wallet_model_WalletManager_setLogLevel(JNIEnv *env, jclass clazz, - jint level) { + jint level) { Monero::WalletManagerFactory::setLogLevel(level); } diff --git a/app/src/main/java/net/mynero/wallet/MainActivity.kt b/app/src/main/java/net/mynero/wallet/MainActivity.kt index 8460226..653852d 100644 --- a/app/src/main/java/net/mynero/wallet/MainActivity.kt +++ b/app/src/main/java/net/mynero/wallet/MainActivity.kt @@ -4,11 +4,7 @@ import android.os.Bundle import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.FragmentActivity -import androidx.lifecycle.Observer -import androidx.lifecycle.lifecycleScope import androidx.navigation.fragment.NavHostFragment -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.launch import net.mynero.wallet.fragment.dialog.PasswordBottomSheetDialog import net.mynero.wallet.fragment.dialog.PasswordBottomSheetDialog.PasswordListener import net.mynero.wallet.fragment.dialog.SendBottomSheetDialog @@ -26,7 +22,6 @@ import net.mynero.wallet.service.TxService import net.mynero.wallet.service.UTXOService import net.mynero.wallet.util.Constants import net.mynero.wallet.util.UriData -import timber.log.Timber import java.io.File class MainActivity : AppCompatActivity(), MoneroHandlerThread.Listener, PasswordListener { diff --git a/app/src/main/java/net/mynero/wallet/adapter/NodeSelectionAdapter.kt b/app/src/main/java/net/mynero/wallet/adapter/NodeSelectionAdapter.kt index 75bac5b..8d66e8b 100644 --- a/app/src/main/java/net/mynero/wallet/adapter/NodeSelectionAdapter.kt +++ b/app/src/main/java/net/mynero/wallet/adapter/NodeSelectionAdapter.kt @@ -107,7 +107,7 @@ class NodeSelectionAdapter(val listener: NodeSelectionAdapterListener?) : if (node.password.isNotEmpty()) { authTextView.visibility = View.VISIBLE } - if(node.trusted) { + if (node.trusted) { trustedTextView.visibility = View.VISIBLE } val nodeAnonymityNetworkImageView = diff --git a/app/src/main/java/net/mynero/wallet/fragment/dialog/NodeSelectionBottomSheetDialog.kt b/app/src/main/java/net/mynero/wallet/fragment/dialog/NodeSelectionBottomSheetDialog.kt index 16f224b..1bbc793 100644 --- a/app/src/main/java/net/mynero/wallet/fragment/dialog/NodeSelectionBottomSheetDialog.kt +++ b/app/src/main/java/net/mynero/wallet/fragment/dialog/NodeSelectionBottomSheetDialog.kt @@ -1,18 +1,13 @@ package net.mynero.wallet.fragment.dialog -import android.app.Activity import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Button -import android.widget.Toast -import androidx.lifecycle.lifecycleScope import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.google.android.material.bottomsheet.BottomSheetDialogFragment -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.launch import net.mynero.wallet.R import net.mynero.wallet.adapter.NodeSelectionAdapter import net.mynero.wallet.adapter.NodeSelectionAdapter.NodeSelectionAdapterListener @@ -20,7 +15,6 @@ import net.mynero.wallet.data.DefaultNodes import net.mynero.wallet.data.Node import net.mynero.wallet.data.Node.Companion.fromJson import net.mynero.wallet.data.Node.Companion.fromString -import net.mynero.wallet.model.WalletManager import net.mynero.wallet.service.DaemonService import net.mynero.wallet.service.PrefService import net.mynero.wallet.util.Constants diff --git a/app/src/main/java/net/mynero/wallet/fragment/home/HomeFragment.kt b/app/src/main/java/net/mynero/wallet/fragment/home/HomeFragment.kt index ae83e2f..9c1ff29 100644 --- a/app/src/main/java/net/mynero/wallet/fragment/home/HomeFragment.kt +++ b/app/src/main/java/net/mynero/wallet/fragment/home/HomeFragment.kt @@ -9,9 +9,7 @@ import android.widget.Button import android.widget.ImageView import android.widget.ProgressBar import android.widget.TextView -import android.widget.Toast import androidx.fragment.app.Fragment -import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.lifecycleScope import androidx.navigation.NavDirections @@ -24,9 +22,7 @@ import net.mynero.wallet.MainActivity import net.mynero.wallet.R import net.mynero.wallet.adapter.TransactionInfoAdapter import net.mynero.wallet.adapter.TransactionInfoAdapter.TxInfoAdapterListener -import net.mynero.wallet.model.EnumTorState import net.mynero.wallet.model.TransactionInfo -import net.mynero.wallet.model.Wallet import net.mynero.wallet.model.WalletManager import net.mynero.wallet.service.BalanceService import net.mynero.wallet.service.BlockchainService @@ -34,10 +30,7 @@ import net.mynero.wallet.service.DaemonService import net.mynero.wallet.service.HistoryService import net.mynero.wallet.service.PrefService import net.mynero.wallet.service.ProxyService -import net.mynero.wallet.service.SamouraiTorManager -import net.mynero.wallet.service.TorKmpManager import net.mynero.wallet.util.Constants -import timber.log.Timber class HomeFragment : Fragment(), TxInfoAdapterListener { private var startHeight: Long = 0 @@ -82,7 +75,8 @@ class HomeFragment : Fragment(), TxInfoAdapterListener { ProxyService.instance?.proxyChangeEvents?.observe(viewLifecycleOwner) { proxy -> lifecycleScope.launch(Dispatchers.IO) { Log.d("HomeFragment", "Updating proxy, restarting wallet. proxy=$proxy") - val finalProxy = if(proxy.isNotEmpty() && ProxyService.instance?.usingProxy == true) proxy else "" + val finalProxy = + if (proxy.isNotEmpty() && ProxyService.instance?.usingProxy == true) proxy else "" WalletManager.instance?.setProxy(finalProxy) WalletManager.instance?.wallet?.setProxy(finalProxy) WalletManager.instance?.wallet?.init(0) @@ -177,13 +171,13 @@ class HomeFragment : Fragment(), TxInfoAdapterListener { val samouraiTorManager = ProxyService.instance?.samouraiTorManager samouraiTorManager?.getTorStateLiveData()?.observe(viewLifecycleOwner) { samouraiTorManager.getProxy()?.address()?.let { socketAddress -> - if(socketAddress.toString().isEmpty()) return@let - if(ProxyService.instance?.usingProxy == true && ProxyService.instance?.useBundledTor == true) { + if (socketAddress.toString().isEmpty()) return@let + if (ProxyService.instance?.usingProxy == true && ProxyService.instance?.useBundledTor == true) { val proxyString = socketAddress.toString().substring(1) val address = proxyString.split(":")[0] val port = proxyString.split(":")[1] - if(WalletManager.instance?.proxy != proxyString) + if (WalletManager.instance?.proxy != proxyString) refreshProxy(address, port) } } @@ -193,7 +187,7 @@ class HomeFragment : Fragment(), TxInfoAdapterListener { private fun refreshProxy(proxyAddress: String, proxyPort: String) { val cachedProxyAddress = ProxyService.instance?.proxyAddress val cachedProxyPort = ProxyService.instance?.proxyPort - if((proxyAddress != cachedProxyAddress) || (proxyPort != cachedProxyPort)) { + if ((proxyAddress != cachedProxyAddress) || (proxyPort != cachedProxyPort)) { ProxyService.instance?.updateProxy(proxyAddress, proxyPort) } } diff --git a/app/src/main/java/net/mynero/wallet/fragment/onboarding/OnboardingFragment.kt b/app/src/main/java/net/mynero/wallet/fragment/onboarding/OnboardingFragment.kt index 168dee2..cb0382d 100644 --- a/app/src/main/java/net/mynero/wallet/fragment/onboarding/OnboardingFragment.kt +++ b/app/src/main/java/net/mynero/wallet/fragment/onboarding/OnboardingFragment.kt @@ -163,13 +163,14 @@ class OnboardingFragment : Fragment(), NodeSelectionDialogListener, AddNodeListe } val samouraiTorManager = ProxyService.instance?.samouraiTorManager - val indicatorCircle = view?.findViewById(R.id.onboarding_tor_loading_progressindicator) + val indicatorCircle = + view?.findViewById(R.id.onboarding_tor_loading_progressindicator) val torIcon = view?.findViewById(R.id.onboarding_tor_icon) samouraiTorManager?.getTorStateLiveData()?.observe(viewLifecycleOwner) { state -> samouraiTorManager.getProxy()?.address()?.let { socketAddress -> - if(socketAddress.toString().isEmpty()) return@let - if(mViewModel?.useProxy?.value == true && mViewModel?.useBundledTor?.value == true) { + if (socketAddress.toString().isEmpty()) return@let + if (mViewModel?.useProxy?.value == true && mViewModel?.useBundledTor?.value == true) { torIcon?.visibility = View.VISIBLE indicatorCircle?.visibility = View.INVISIBLE val proxyString = socketAddress.toString().substring(1) @@ -187,10 +188,12 @@ class OnboardingFragment : Fragment(), NodeSelectionDialogListener, AddNodeListe torIcon?.visibility = View.INVISIBLE indicatorCircle?.visibility = View.INVISIBLE } + EnumTorState.STARTING, EnumTorState.STOPPING -> { torIcon?.visibility = View.INVISIBLE indicatorCircle?.visibility = View.VISIBLE } + else -> {} } } diff --git a/app/src/main/java/net/mynero/wallet/fragment/onboarding/OnboardingViewModel.kt b/app/src/main/java/net/mynero/wallet/fragment/onboarding/OnboardingViewModel.kt index 2bb2727..e7175b3 100644 --- a/app/src/main/java/net/mynero/wallet/fragment/onboarding/OnboardingViewModel.kt +++ b/app/src/main/java/net/mynero/wallet/fragment/onboarding/OnboardingViewModel.kt @@ -52,13 +52,13 @@ class OnboardingViewModel : ViewModel() { _creatingWallet, ProxyService.instance?.samouraiTorManager?.getTorStateLiveData() ) { seedType, useProxy, proxyAddress, proxyPort, useBundledTor, passphrase, confirmedPassphrase, creatingWallet, torState -> - if(seedType == null || useProxy == null || proxyAddress == null || proxyPort == null || useBundledTor == null || passphrase == null || confirmedPassphrase == null || creatingWallet == null) return@combineLiveDatas false - if((passphrase.isNotEmpty() || confirmedPassphrase.isNotEmpty()) && passphrase != confirmedPassphrase) return@combineLiveDatas false - if(creatingWallet) return@combineLiveDatas false - if(seedType == SeedType.POLYSEED && (passphrase.isEmpty() || confirmedPassphrase.isEmpty())) return@combineLiveDatas false - if(useProxy && (proxyAddress.isEmpty() || proxyPort.isEmpty()) && !useBundledTor) return@combineLiveDatas false + if (seedType == null || useProxy == null || proxyAddress == null || proxyPort == null || useBundledTor == null || passphrase == null || confirmedPassphrase == null || creatingWallet == null) return@combineLiveDatas false + if ((passphrase.isNotEmpty() || confirmedPassphrase.isNotEmpty()) && passphrase != confirmedPassphrase) return@combineLiveDatas false + if (creatingWallet) return@combineLiveDatas false + if (seedType == SeedType.POLYSEED && (passphrase.isEmpty() || confirmedPassphrase.isEmpty())) return@combineLiveDatas false + if (useProxy && (proxyAddress.isEmpty() || proxyPort.isEmpty()) && !useBundledTor) return@combineLiveDatas false val progress = torState?.progressIndicator ?: 0 - if(useBundledTor && progress < 100 && useProxy) return@combineLiveDatas false + if (useBundledTor && progress < 100 && useProxy) return@combineLiveDatas false return@combineLiveDatas true } @@ -227,24 +227,25 @@ class OnboardingViewModel : ViewModel() { fun setProxyAddress(address: String) { _proxyAddress.value = address - if(address.isEmpty()) PrefService.instance?.deleteProxy() + if (address.isEmpty()) PrefService.instance?.deleteProxy() val port = _proxyPort.value ?: return ProxyService.instance?.updateProxy(address, port) } fun setProxyPort(port: String) { _proxyPort.value = port - if(port.isEmpty()) PrefService.instance?.deleteProxy() + if (port.isEmpty()) PrefService.instance?.deleteProxy() val address = _proxyAddress.value ?: return ProxyService.instance?.updateProxy(address, port) } fun setUseBundledTor(useBundled: Boolean) { _useBundledTor.value = useBundled - PrefService.instance?.edit()?.putBoolean(Constants.PREF_USE_BUNDLED_TOR, useBundled)?.apply() + PrefService.instance?.edit()?.putBoolean(Constants.PREF_USE_BUNDLED_TOR, useBundled) + ?.apply() val samouraiTorManager = ProxyService.instance?.samouraiTorManager - if(useBundled && ProxyService.instance?.usingProxy == true) { + if (useBundled && ProxyService.instance?.usingProxy == true) { samouraiTorManager?.start() } else { samouraiTorManager?.stop() @@ -256,7 +257,7 @@ class OnboardingViewModel : ViewModel() { PrefService.instance?.edit()?.putBoolean(Constants.PREF_USES_PROXY, useProxy)?.apply() val samouraiTorManager = ProxyService.instance?.samouraiTorManager - if(useProxy && ProxyService.instance?.useBundledTor == true) { + if (useProxy && ProxyService.instance?.useBundledTor == true) { samouraiTorManager?.start() } else { samouraiTorManager?.stop() diff --git a/app/src/main/java/net/mynero/wallet/fragment/send/SendFragment.kt b/app/src/main/java/net/mynero/wallet/fragment/send/SendFragment.kt index 7b9bb0d..6c7de0e 100644 --- a/app/src/main/java/net/mynero/wallet/fragment/send/SendFragment.kt +++ b/app/src/main/java/net/mynero/wallet/fragment/send/SendFragment.kt @@ -148,7 +148,10 @@ class SendFragment : Fragment() { } sendTxSlider?.let { slideToActView -> - ViewCompat.addAccessibilityAction(slideToActView, getString(R.string.approve_the_transaction)) { _, _ -> + ViewCompat.addAccessibilityAction( + slideToActView, + getString(R.string.approve_the_transaction) + ) { _, _ -> confirmSlider() return@addAccessibilityAction true } diff --git a/app/src/main/java/net/mynero/wallet/fragment/settings/SettingsFragment.kt b/app/src/main/java/net/mynero/wallet/fragment/settings/SettingsFragment.kt index c4eb485..9c60450 100644 --- a/app/src/main/java/net/mynero/wallet/fragment/settings/SettingsFragment.kt +++ b/app/src/main/java/net/mynero/wallet/fragment/settings/SettingsFragment.kt @@ -1,7 +1,6 @@ package net.mynero.wallet.fragment.settings import android.os.Bundle -import android.util.Patterns import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -10,12 +9,10 @@ import android.widget.CheckBox import android.widget.CompoundButton import android.widget.EditText import android.widget.ImageView -import android.widget.Switch import android.widget.Toast import androidx.activity.OnBackPressedCallback import androidx.appcompat.widget.SwitchCompat import androidx.constraintlayout.widget.ConstraintLayout -import androidx.core.widget.addTextChangedListener import androidx.fragment.app.Fragment import androidx.lifecycle.ViewModelProvider import androidx.navigation.fragment.NavHostFragment @@ -84,13 +81,18 @@ class SettingsFragment : Fragment(), PasswordListener, NodeSelectionDialogListen val cachedUsingBundledTor = ProxyService.instance?.useBundledTor == true val useProxyVisibility = if (cachedUsingProxy) View.VISIBLE else View.GONE - walletProxyPortEditText?.visibility = if (cachedUsingBundledTor) View.GONE else useProxyVisibility - walletProxyAddressEditText?.visibility = if (cachedUsingBundledTor) View.GONE else useProxyVisibility + walletProxyPortEditText?.visibility = + if (cachedUsingBundledTor) View.GONE else useProxyVisibility + walletProxyAddressEditText?.visibility = + if (cachedUsingBundledTor) View.GONE else useProxyVisibility proxySettingsLayout?.visibility = useProxyVisibility - streetModeSwitch?.isChecked = PrefService.instance?.getBoolean(Constants.PREF_STREET_MODE, false) == true - monerochanSwitch?.isChecked = PrefService.instance?.getBoolean(Constants.PREF_MONEROCHAN, true) == true - donationSwitch?.isChecked = PrefService.instance?.getBoolean(Constants.PREF_DONATE_PER_TX, false) == true + streetModeSwitch?.isChecked = + PrefService.instance?.getBoolean(Constants.PREF_STREET_MODE, false) == true + monerochanSwitch?.isChecked = + PrefService.instance?.getBoolean(Constants.PREF_MONEROCHAN, true) == true + donationSwitch?.isChecked = + PrefService.instance?.getBoolean(Constants.PREF_DONATE_PER_TX, false) == true useBundledTor?.isChecked = cachedUsingBundledTor torSwitch?.isChecked = cachedUsingProxy updateProxy(cachedProxyAddress, cachedProxyPort) @@ -161,7 +163,7 @@ class SettingsFragment : Fragment(), PasswordListener, NodeSelectionDialogListen private fun bindObservers() { mViewModel?.useProxy?.observe(viewLifecycleOwner) { b -> - val visibility = if(b) View.VISIBLE else View.GONE + val visibility = if (b) View.VISIBLE else View.GONE proxySettingsLayout?.visibility = visibility val useBundledTor = mViewModel?.useBundledTor?.value == true @@ -173,19 +175,20 @@ class SettingsFragment : Fragment(), PasswordListener, NodeSelectionDialogListen mViewModel?.useBundledTor?.observe(viewLifecycleOwner) { isChecked -> val usingProxy = mViewModel?.useProxy?.value == true - val visibility = if(usingProxy) View.VISIBLE else View.GONE + val visibility = if (usingProxy) View.VISIBLE else View.GONE walletProxyPortEditText?.visibility = if (isChecked) View.GONE else visibility walletProxyAddressEditText?.visibility = if (isChecked) View.GONE else visibility } val samouraiTorManager = ProxyService.instance?.samouraiTorManager - val indicatorCircle = view?.findViewById(R.id.settings_tor_loading_progressindicator) + val indicatorCircle = + view?.findViewById(R.id.settings_tor_loading_progressindicator) val torIcon = view?.findViewById(R.id.settings_tor_icon) samouraiTorManager?.getTorStateLiveData()?.observe(viewLifecycleOwner) { state -> samouraiTorManager.getProxy()?.address()?.let { socketAddress -> - if(socketAddress.toString().isEmpty()) return@let - if(mViewModel?.useProxy?.value == true && mViewModel?.useBundledTor?.value == true) { + if (socketAddress.toString().isEmpty()) return@let + if (mViewModel?.useProxy?.value == true && mViewModel?.useBundledTor?.value == true) { torIcon?.visibility = View.VISIBLE indicatorCircle?.visibility = View.INVISIBLE val proxyString = socketAddress.toString().substring(1) @@ -203,10 +206,12 @@ class SettingsFragment : Fragment(), PasswordListener, NodeSelectionDialogListen torIcon?.visibility = View.INVISIBLE indicatorCircle?.visibility = View.INVISIBLE } + EnumTorState.STARTING, EnumTorState.STOPPING -> { torIcon?.visibility = View.INVISIBLE indicatorCircle?.visibility = View.VISIBLE } + else -> {} } } @@ -224,7 +229,7 @@ class SettingsFragment : Fragment(), PasswordListener, NodeSelectionDialogListen val savedProxyAddress = ProxyService.instance?.proxyAddress val savedProxyPort = ProxyService.instance?.proxyPort - if(proxyAddress != savedProxyAddress || proxyPort != savedProxyPort) + if (proxyAddress != savedProxyAddress || proxyPort != savedProxyPort) ProxyService.instance?.updateProxy(proxyAddress, proxyPort) } diff --git a/app/src/main/java/net/mynero/wallet/fragment/settings/SettingsViewModel.kt b/app/src/main/java/net/mynero/wallet/fragment/settings/SettingsViewModel.kt index b236c02..13682a7 100644 --- a/app/src/main/java/net/mynero/wallet/fragment/settings/SettingsViewModel.kt +++ b/app/src/main/java/net/mynero/wallet/fragment/settings/SettingsViewModel.kt @@ -1,11 +1,8 @@ package net.mynero.wallet.fragment.settings -import android.util.Patterns import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel -import net.mynero.wallet.MoneroApplication -import net.mynero.wallet.model.WalletManager import net.mynero.wallet.service.PrefService import net.mynero.wallet.service.ProxyService import net.mynero.wallet.util.Constants @@ -26,7 +23,7 @@ class SettingsViewModel : ViewModel() { PrefService.instance?.edit()?.putBoolean(Constants.PREF_USES_PROXY, use)?.apply() val samouraiTorManager = ProxyService.instance?.samouraiTorManager - if(use && ProxyService.instance?.useBundledTor == true) { + if (use && ProxyService.instance?.useBundledTor == true) { samouraiTorManager?.start() } else { samouraiTorManager?.stop() @@ -38,7 +35,7 @@ class SettingsViewModel : ViewModel() { PrefService.instance?.edit()?.putBoolean(Constants.PREF_USE_BUNDLED_TOR, use)?.apply() val samouraiTorManager = ProxyService.instance?.samouraiTorManager - if(use && ProxyService.instance?.usingProxy == true) { + if (use && ProxyService.instance?.usingProxy == true) { samouraiTorManager?.start() } else { samouraiTorManager?.stop() diff --git a/app/src/main/java/net/mynero/wallet/model/TorState.kt b/app/src/main/java/net/mynero/wallet/model/TorState.kt index 785d056..35bddcb 100644 --- a/app/src/main/java/net/mynero/wallet/model/TorState.kt +++ b/app/src/main/java/net/mynero/wallet/model/TorState.kt @@ -1,14 +1,6 @@ package net.mynero.wallet.model class TorState { - var state : EnumTorState = EnumTorState.OFF - get() = field - set(value) { - field = value - } - var progressIndicator : Int = 0 - get() = field - set(value) { - field = value - } + var state: EnumTorState = EnumTorState.OFF + var progressIndicator: Int = 0 } \ No newline at end of file diff --git a/app/src/main/java/net/mynero/wallet/model/Wallet.kt b/app/src/main/java/net/mynero/wallet/model/Wallet.kt index a5d40d2..ab0667a 100644 --- a/app/src/main/java/net/mynero/wallet/model/Wallet.kt +++ b/app/src/main/java/net/mynero/wallet/model/Wallet.kt @@ -18,7 +18,6 @@ package net.mynero.wallet.model import android.util.Log import android.util.Pair import net.mynero.wallet.data.Subaddress -import timber.log.Timber import java.io.File import java.text.SimpleDateFormat import java.util.Date @@ -212,16 +211,19 @@ class Wallet { fun setTrustedDaemon(trusted: Boolean) { setTrustedDaemonJ(trusted) } + private external fun setTrustedDaemonJ(trusted: Boolean) fun isTrustedDaemon(): Boolean { - return isTrustedDaemonJ(); + return isTrustedDaemonJ() } + private external fun isTrustedDaemonJ(): Boolean fun setProxy(address: String?): Boolean { return setProxyJ(address) } + private external fun setProxyJ(address: String?): Boolean val balance: Long get() = getBalance(accountIndex) @@ -238,11 +240,13 @@ class Wallet { fun getBlockChainHeight(): Long { return getBlockChainHeightJ().minus(1) } + private external fun getBlockChainHeightJ(): Long external fun getApproximateBlockChainHeight(): Long fun getDaemonBlockChainHeight(): Long { return getDaemonBlockChainHeightJ().minus(1) } + private external fun getDaemonBlockChainHeightJ(): Long external fun getDaemonBlockChainTargetHeight(): Long @@ -253,6 +257,7 @@ class Wallet { fun startRefresh() { startRefreshJ() } + private external fun startRefreshJ() external fun pauseRefresh() external fun refresh(): Boolean diff --git a/app/src/main/java/net/mynero/wallet/service/DaemonService.kt b/app/src/main/java/net/mynero/wallet/service/DaemonService.kt index 4584263..53add24 100644 --- a/app/src/main/java/net/mynero/wallet/service/DaemonService.kt +++ b/app/src/main/java/net/mynero/wallet/service/DaemonService.kt @@ -1,12 +1,7 @@ package net.mynero.wallet.service -import android.util.Patterns -import androidx.lifecycle.LiveData -import androidx.lifecycle.MutableLiveData import net.mynero.wallet.data.Node import net.mynero.wallet.livedata.SingleLiveEvent -import net.mynero.wallet.model.WalletManager -import net.mynero.wallet.util.Constants class DaemonService(thread: MoneroHandlerThread) : ServiceBase(thread) { val daemonChangeEvents: SingleLiveEvent = SingleLiveEvent() diff --git a/app/src/main/java/net/mynero/wallet/service/MoneroHandlerThread.kt b/app/src/main/java/net/mynero/wallet/service/MoneroHandlerThread.kt index 8c76a1f..7ad1b0a 100644 --- a/app/src/main/java/net/mynero/wallet/service/MoneroHandlerThread.kt +++ b/app/src/main/java/net/mynero/wallet/service/MoneroHandlerThread.kt @@ -16,7 +16,6 @@ */ package net.mynero.wallet.service -import android.util.Log import net.mynero.wallet.model.PendingTransaction import net.mynero.wallet.model.TransactionOutput import net.mynero.wallet.model.Wallet @@ -37,7 +36,6 @@ import java.security.SecureRandom class MoneroHandlerThread(name: String, val listener: Listener?, wallet: Wallet) : Thread(null, null, name, THREAD_STACK_SIZE), WalletListener { private val wallet: Wallet - private var triesLeft = 5 init { this.wallet = wallet @@ -75,7 +73,8 @@ class MoneroHandlerThread(name: String, val listener: Listener?, wallet: Wallet) override fun unconfirmedMoneyReceived(txId: String?, amount: Long) {} override fun newBlock(height: Long) { refresh(false) - BlockchainService.instance?.daemonHeight = if (wallet.isSynchronized) height else 0 // when 0 it fetches from C++ + BlockchainService.instance?.daemonHeight = + if (wallet.isSynchronized) height else 0 // when 0 it fetches from C++ } override fun updated() { @@ -89,11 +88,11 @@ class MoneroHandlerThread(name: String, val listener: Listener?, wallet: Wallet) BlockchainService.instance?.daemonHeight = daemonHeight status?.let { BlockchainService.instance?.setConnectionStatus(it) } if (status === ConnectionStatus.ConnectionStatus_Disconnected || status == null) { - tryRestartOrFail() + tryRestartConnection() } else { val heightDiff = daemonHeight - chainHeight - if(heightDiff >= 2) { - tryRestartOrFail() + if (heightDiff >= 2) { + tryRestartConnection() } else { Timber.d("refreshed() Synchronized") wallet.setSynchronized() @@ -104,16 +103,10 @@ class MoneroHandlerThread(name: String, val listener: Listener?, wallet: Wallet) } } - private fun tryRestartOrFail() { - Timber.d("refreshed() Disconnected") - if (triesLeft > 0) { - Timber.d("refreshed() Starting refresh") - wallet.startRefresh() - triesLeft-- - } else { - Timber.d("refreshed() On connection fail") - listener?.onConnectionFail() - } + private fun tryRestartConnection() { + Timber.d("refreshed() Starting connection retry") + wallet.init(0) + wallet.startRefresh() } private fun refresh(walletSynced: Boolean) { diff --git a/app/src/main/java/net/mynero/wallet/service/PrefService.kt b/app/src/main/java/net/mynero/wallet/service/PrefService.kt index 30bc86c..8a58dd5 100644 --- a/app/src/main/java/net/mynero/wallet/service/PrefService.kt +++ b/app/src/main/java/net/mynero/wallet/service/PrefService.kt @@ -81,12 +81,12 @@ class PrefService(application: MoneroApplication) : ServiceBase(null) { } fun saveProxy(address: String, port: String): String? { - if(address.isEmpty() || port.isEmpty()) { + if (address.isEmpty() || port.isEmpty()) { deleteProxy() return null } val proxyAddress = "$address:$port" - if(proxyAddress == ":") return null + if (proxyAddress == ":") return null Log.d("PrefService", "Setting proxy. proxyAddress=$proxyAddress") edit()?.putString(Constants.PREF_PROXY, proxyAddress)?.apply() return proxyAddress diff --git a/app/src/main/java/net/mynero/wallet/service/ProxyService.kt b/app/src/main/java/net/mynero/wallet/service/ProxyService.kt index 07ec855..de9a77a 100644 --- a/app/src/main/java/net/mynero/wallet/service/ProxyService.kt +++ b/app/src/main/java/net/mynero/wallet/service/ProxyService.kt @@ -15,7 +15,7 @@ class ProxyService(application: Application) : ServiceBase(null) { instance = this samouraiTorManager = SamouraiTorManager(application, TorKmpManager(application)) - if(useBundledTor && usingProxy) { + if (useBundledTor && usingProxy) { samouraiTorManager?.start() } } diff --git a/app/src/main/java/net/mynero/wallet/service/SamouraiTorManager.kt b/app/src/main/java/net/mynero/wallet/service/SamouraiTorManager.kt index 7e09aaf..f915ac9 100644 --- a/app/src/main/java/net/mynero/wallet/service/SamouraiTorManager.kt +++ b/app/src/main/java/net/mynero/wallet/service/SamouraiTorManager.kt @@ -5,7 +5,10 @@ import androidx.lifecycle.MutableLiveData import net.mynero.wallet.model.TorState import java.net.Proxy -class SamouraiTorManager(private val appContext: Application?, private val torKmpManager: TorKmpManager) { +class SamouraiTorManager( + private val appContext: Application?, + private val torKmpManager: TorKmpManager +) { fun getTorStateLiveData(): MutableLiveData { return torKmpManager.torStateLiveData } diff --git a/app/src/main/java/net/mynero/wallet/service/TorKmpManager.kt b/app/src/main/java/net/mynero/wallet/service/TorKmpManager.kt index 3a0084c..66a17ac 100644 --- a/app/src/main/java/net/mynero/wallet/service/TorKmpManager.kt +++ b/app/src/main/java/net/mynero/wallet/service/TorKmpManager.kt @@ -5,7 +5,6 @@ import android.util.Log import android.widget.Toast import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData -import net.mynero.wallet.model.TorState import io.matthewnelson.kmp.tor.KmpTorLoaderAndroid import io.matthewnelson.kmp.tor.TorConfigProviderAndroid import io.matthewnelson.kmp.tor.common.address.* @@ -26,11 +25,11 @@ import io.matthewnelson.kmp.tor.manager.common.state.isStarting import io.matthewnelson.kmp.tor.manager.common.state.isStopping import kotlinx.coroutines.* import net.mynero.wallet.model.EnumTorState -import java.lang.Exception +import net.mynero.wallet.model.TorState import java.net.InetSocketAddress import java.net.Proxy -class TorKmpManager(application : Application) { +class TorKmpManager(application: Application) { private val TAG = "TorListener" @@ -61,11 +60,15 @@ class TorKmpManager(application : Application) { put(socks.set(AorDorPort.Value(PortProxy(9263)))) // Set Flags - socks.setFlags(setOf( - Ports.Socks.Flag.OnionTrafficOnly - )).setIsolationFlags(setOf( - Ports.IsolationFlag.IsolateClientAddr, - )).set(AorDorPort.Value(PortProxy(9264))) + socks.setFlags( + setOf( + Ports.Socks.Flag.OnionTrafficOnly + ) + ).setIsolationFlags( + setOf( + Ports.IsolationFlag.IsolateClientAddr, + ) + ).set(AorDorPort.Value(PortProxy(9264))) put(socks) // reset our socks object to defaults @@ -142,23 +145,36 @@ class TorKmpManager(application : Application) { addSegment("test_service") } // Add Hidden services - put(HiddenService() - .setPorts(ports = setOf( - // Use a unix domain socket to communicate via IPC instead of over TCP - HiddenService.UnixSocket(virtualPort = Port(80), targetUnixSocket = hsPath.builder { - addSegment(HiddenService.UnixSocket.DEFAULT_UNIX_SOCKET_NAME) - }), - )) - .setMaxStreams(maxStreams = HiddenService.MaxStreams(value = 2)) - .setMaxStreamsCloseCircuit(value = TorF.True) - .set(FileSystemDir(path = hsPath)) + put( + HiddenService() + .setPorts( + ports = setOf( + // Use a unix domain socket to communicate via IPC instead of over TCP + HiddenService.UnixSocket( + virtualPort = Port(80), + targetUnixSocket = hsPath.builder { + addSegment(HiddenService.UnixSocket.DEFAULT_UNIX_SOCKET_NAME) + }), + ) + ) + .setMaxStreams(maxStreams = HiddenService.MaxStreams(value = 2)) + .setMaxStreamsCloseCircuit(value = TorF.True) + .set(FileSystemDir(path = hsPath)) ) put(HiddenService() - .setPorts(ports = setOf( - HiddenService.Ports(virtualPort = Port(80), targetPort = Port(1030)), // http - HiddenService.Ports(virtualPort = Port(443), targetPort = Port(1030)) // https - )) + .setPorts( + ports = setOf( + HiddenService.Ports( + virtualPort = Port(80), + targetPort = Port(1030) + ), // http + HiddenService.Ports( + virtualPort = Port(443), + targetPort = Port(1030) + ) // https + ) + ) .set(FileSystemDir(path = workDir.builder { addSegment(HiddenService.DEFAULT_PARENT_DIR_NAME) @@ -176,7 +192,11 @@ class TorKmpManager(application : Application) { } private val manager: TorManager by lazy { - TorManager.newInstance(application = application, loader = loaderAndroid, requiredEvents = null) + TorManager.newInstance( + application = application, + loader = loaderAndroid, + requiredEvents = null + ) } // only expose necessary interfaces @@ -192,12 +212,9 @@ class TorKmpManager(application : Application) { } val torStateLiveData: MutableLiveData = MutableLiveData() - get() = field var torState: TorState = TorState() - get() = field var proxy: Proxy? = null - get() = field init { manager.debug(true) @@ -210,7 +227,7 @@ class TorKmpManager(application : Application) { } fun isStarting(): Boolean { - return manager.state.isStarting(); + return manager.state.isStarting() } @@ -231,7 +248,7 @@ class TorKmpManager(application : Application) { } } - private inner class TorListener: TorManagerEvent.Listener() { + private inner class TorListener : TorManagerEvent.Listener() { private val _eventLines: MutableLiveData = MutableLiveData("") val eventLines: LiveData = _eventLines private val events: MutableList = ArrayList(50) @@ -313,7 +330,8 @@ class TorKmpManager(application : Application) { } else { info.socksInfoToProxyAddressOrNull()?.firstOrNull()?.let { proxyAddress -> @Suppress("UNUSED_VARIABLE") - val socket = InetSocketAddress(proxyAddress.address.value, proxyAddress.port.value) + val socket = + InetSocketAddress(proxyAddress.address.value, proxyAddress.port.value) proxy = Proxy(Proxy.Type.SOCKS, socket) } } diff --git a/app/src/main/res/drawable/button_bg_disabled_left.xml b/app/src/main/res/drawable/button_bg_disabled_left.xml index ca8b60c..2288217 100644 --- a/app/src/main/res/drawable/button_bg_disabled_left.xml +++ b/app/src/main/res/drawable/button_bg_disabled_left.xml @@ -5,6 +5,7 @@ android:left="8dp" android:right="8dp" /> - + diff --git a/app/src/main/res/drawable/button_bg_disabled_right.xml b/app/src/main/res/drawable/button_bg_disabled_right.xml index ff22811..162ed94 100644 --- a/app/src/main/res/drawable/button_bg_disabled_right.xml +++ b/app/src/main/res/drawable/button_bg_disabled_right.xml @@ -5,6 +5,7 @@ android:left="8dp" android:right="8dp" /> - + diff --git a/app/src/main/res/drawable/button_bg_enabled_left.xml b/app/src/main/res/drawable/button_bg_enabled_left.xml index 21b26c5..5a41716 100644 --- a/app/src/main/res/drawable/button_bg_enabled_left.xml +++ b/app/src/main/res/drawable/button_bg_enabled_left.xml @@ -5,6 +5,7 @@ android:left="8dp" android:right="8dp" /> - + diff --git a/app/src/main/res/drawable/button_bg_enabled_right.xml b/app/src/main/res/drawable/button_bg_enabled_right.xml index 62f9073..c2c201b 100644 --- a/app/src/main/res/drawable/button_bg_enabled_right.xml +++ b/app/src/main/res/drawable/button_bg_enabled_right.xml @@ -5,6 +5,7 @@ android:left="8dp" android:right="8dp" /> - + diff --git a/app/src/main/res/drawable/card_bg.xml b/app/src/main/res/drawable/card_bg.xml index 783f1f6..8d92a0b 100644 --- a/app/src/main/res/drawable/card_bg.xml +++ b/app/src/main/res/drawable/card_bg.xml @@ -2,10 +2,10 @@ + android:top="12dp" /> diff --git a/app/src/main/res/drawable/card_bg_no_top.xml b/app/src/main/res/drawable/card_bg_no_top.xml index d2b2c79..afd1515 100644 --- a/app/src/main/res/drawable/card_bg_no_top.xml +++ b/app/src/main/res/drawable/card_bg_no_top.xml @@ -2,9 +2,9 @@ + android:right="12dp" /> diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml index ca3826a..07d5da9 100644 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -1,74 +1,170 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:viewportHeight="108"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_refresh.xml b/app/src/main/res/drawable/ic_refresh.xml index 0e26860..7cb9061 100644 --- a/app/src/main/res/drawable/ic_refresh.xml +++ b/app/src/main/res/drawable/ic_refresh.xml @@ -6,5 +6,5 @@ android:viewportHeight="24.0"> + android:pathData="M17.65,6.35C16.2,4.9 14.21,4 12,4c-4.42,0 -7.99,3.58 -7.99,8s3.57,8 7.99,8c3.73,0 6.84,-2.55 7.73,-6h-2.08c-0.82,2.33 -3.04,4 -5.65,4 -3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6c1.66,0 3.14,0.69 4.22,1.78L13,11h7V4l-2.35,2.35z" /> \ No newline at end of file diff --git a/app/src/main/res/layout/add_node_bottom_sheet_dialog.xml b/app/src/main/res/layout/add_node_bottom_sheet_dialog.xml index 75d55b9..5e09768 100644 --- a/app/src/main/res/layout/add_node_bottom_sheet_dialog.xml +++ b/app/src/main/res/layout/add_node_bottom_sheet_dialog.xml @@ -4,9 +4,9 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/oled_dialogBackgroundColor" android:fillViewport="true" android:fitsSystemWindows="true" - android:background="@color/oled_dialogBackgroundColor" android:padding="24dp"> @@ -61,13 +61,13 @@ android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:background="@drawable/edittext_bg" + android:digits="QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890.:-[]" android:hint="@string/node_address_hint" android:inputType="text" - android:digits="QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890.:-[]" app:layout_constraintBottom_toTopOf="@id/trusted_node_checkbox" app:layout_constraintEnd_toStartOf="@id/node_port_edittext" - app:layout_constraintTop_toBottomOf="@id/node_name_edittext" - app:layout_constraintStart_toStartOf="parent" /> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/node_name_edittext" /> + app:layout_constraintStart_toEndOf="@id/address_edittext" + app:layout_constraintTop_toTopOf="@id/address_edittext" /> + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/address_edittext" />