Merge branch 'master' into master

This commit is contained in:
m2049r 2020-06-01 13:43:16 +02:00 committed by GitHub
commit aa66a12dac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 164 additions and 42 deletions

View File

@ -7,8 +7,8 @@ android {
applicationId "com.m2049r.xmrwallet"
minSdkVersion 21
targetSdkVersion 28
versionCode 201
versionName "1.12.11 'Caerbannog'"
versionCode 300
versionName "1.13.0 'ReStart'"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {

View File

@ -785,7 +785,7 @@ Java_com_m2049r_xmrwallet_model_Wallet_getDaemonBlockChainTargetHeight(JNIEnv *e
}
JNIEXPORT jboolean JNICALL
Java_com_m2049r_xmrwallet_model_Wallet_isSynchronized(JNIEnv *env, jobject instance) {
Java_com_m2049r_xmrwallet_model_Wallet_isSynchronizedJ(JNIEnv *env, jobject instance) {
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
return static_cast<jboolean>(wallet->synchronized());
}
@ -909,6 +909,16 @@ Java_com_m2049r_xmrwallet_model_Wallet_refreshAsync(JNIEnv *env, jobject instanc
wallet->refreshAsync();
}
//TODO virtual bool rescanBlockchain() = 0;
//virtual void rescanBlockchainAsync() = 0;
JNIEXPORT void JNICALL
Java_com_m2049r_xmrwallet_model_Wallet_rescanBlockchainAsync(JNIEnv *env, jobject instance) {
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
wallet->rescanBlockchainAsync();
}
//TODO virtual void setAutoRefreshInterval(int millis) = 0;
//TODO virtual int autoRefreshInterval() const = 0;

View File

@ -438,7 +438,7 @@ public class GenerateFragment extends Fragment {
height = RestoreHeight.getInstance().getHeight(parser.parse(restoreHeight));
} catch (ParseException ex) {
}
if (height <= 0)
if ((height <= 0) && (restoreHeight.length() == 8))
try {
// is it a date without dashes?
SimpleDateFormat parser = new SimpleDateFormat("yyyyMMdd");

View File

@ -217,6 +217,20 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
releaseWakeLock();
}
private void onWalletRescan() {
try {
final WalletFragment walletFragment = (WalletFragment)
getSupportFragmentManager().findFragmentByTag(WalletFragment.class.getName());
getWallet().rescanBlockchainAsync();
synced = false;
walletFragment.unsync();
invalidateOptionsMenu();
} catch (ClassCastException ex) {
Timber.d(ex.getLocalizedMessage());
// keep calm and carry on
}
}
@Override
protected void onStop() {
Timber.d("onStop()");
@ -243,7 +257,7 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
public boolean onPrepareOptionsMenu(Menu menu) {
MenuItem renameItem = menu.findItem(R.id.action_rename);
if (renameItem != null)
renameItem.setVisible(hasWallet() && getWallet().isSynchronized());
renameItem.setEnabled(hasWallet() && getWallet().isSynchronized());
MenuItem streetmodeItem = menu.findItem(R.id.action_streetmode);
if (streetmodeItem != null)
if (isStreetMode()) {
@ -251,12 +265,18 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
} else {
streetmodeItem.setIcon(R.drawable.gunther_24dp);
}
final MenuItem rescanItem = menu.findItem(R.id.action_rescan);
if (rescanItem != null)
rescanItem.setEnabled(isSynced());
return super.onPrepareOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_rescan:
onWalletRescan();
return true;
case R.id.action_info:
onWalletDetails();
return true;

View File

@ -356,6 +356,14 @@ public class WalletFragment extends Fragment
if (isVisible()) enableAccountsList(true); //otherwise it is enabled in onResume()
}
public void unsync() {
if (!activityCallback.isWatchOnly()) {
bSend.setVisibility(View.INVISIBLE);
bSend.setEnabled(false);
}
if (isVisible()) enableAccountsList(false); //otherwise it is enabled in onResume()
}
boolean walletLoaded = false;
public void onLoaded() {

View File

@ -130,9 +130,9 @@ public class NodeInfoAdapter extends RecyclerView.Adapter<NodeInfoAdapter.ViewHo
private void showStar() {
if (nodeItem.isFavourite()) {
ibBookmark.setImageResource(R.drawable.ic_bookmark_24dp);
ibBookmark.setImageResource(R.drawable.ic_favorite_24dp);
} else {
ibBookmark.setImageResource(R.drawable.ic_bookmark_border_24dp);
ibBookmark.setImageResource(R.drawable.ic_favorite_border_24dp);
}
}

View File

@ -248,7 +248,13 @@ public class Wallet {
public native long getDaemonBlockChainTargetHeight();
public native boolean isSynchronized();
public native boolean isSynchronizedJ();
public boolean isSynchronized() {
final long daemonHeight = getDaemonBlockChainHeight();
if (daemonHeight == 0) return false;
return isSynchronizedJ() && (getBlockChainHeight() == daemonHeight);
}
public static native String getDisplayAmount(long amount);
@ -278,6 +284,8 @@ public class Wallet {
public native void refreshAsync();
public native void rescanBlockchainAsync();
//TODO virtual void setAutoRefreshInterval(int millis) = 0;
//TODO virtual int autoRefreshInterval() const = 0;

View File

@ -109,6 +109,13 @@ public class RestoreHeight {
blockheight.put("2019-09-01", 1913201L);
blockheight.put("2019-10-01", 1934732L);
blockheight.put("2019-11-01", 1957051L);
blockheight.put("2019-12-01", 1978433L);
blockheight.put("2020-01-01", 2001315L);
blockheight.put("2020-02-01", 2023656L);
blockheight.put("2020-03-01", 2044552L);
blockheight.put("2020-04-01", 2066806L);
blockheight.put("2020-05-01", 2088411L);
blockheight.put("2020-06-01", 2110702L);
}
public long getHeight(String date) {

View File

@ -68,6 +68,9 @@ public class ExchangeEditText extends LinearLayout {
}
boolean ok = true;
String nativeAmount = getNativeAmount();
if (nativeAmount == null) {
ok = false;
} else {
try {
double amount = Double.parseDouble(nativeAmount);
if ((amount < min) || (amount > max)) {
@ -78,6 +81,7 @@ public class ExchangeEditText extends LinearLayout {
Timber.e(ex.getLocalizedMessage());
ok = false;
}
}
if (!ok) {
shakeAmountField();
}

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/gradientPink"
android:pathData="M17,3H7c-1.1,0 -1.99,0.9 -1.99,2L5,21l7,-3 7,3V5c0,-1.1 -0.9,-2 -2,-2z" />
</vector>

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/gradientPink"
android:pathData="M17,3L7,3c-1.1,0 -1.99,0.9 -1.99,2L5,21l7,-3 7,3L19,5c0,-1.1 -0.9,-2 -2,-2zM17,18l-5,-2.18L7,18L7,5h10v13z" />
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/gradientPink"
android:pathData="M12,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/gradientPink"
android:pathData="M16.5,3c-1.74,0 -3.41,0.81 -4.5,2.09C10.91,3.81 9.24,3 7.5,3 4.42,3 2,5.42 2,8.5c0,3.78 3.4,6.86 8.55,11.54L12,21.35l1.45,-1.32C18.6,15.36 22,12.28 22,8.5 22,5.42 19.58,3 16.5,3zM12.1,18.55l-0.1,0.1 -0.1,-0.1C7.14,14.24 4,11.39 4,8.5 4,6.5 5.5,5 7.5,5c1.54,0 3.04,0.99 3.57,2.36h1.87C13.46,5.99 14.96,5 16.5,5c2,0 3.5,1.5 3.5,3.5 0,2.89 -3.14,5.74 -7.9,10.05z"/>
</vector>

View File

@ -18,7 +18,7 @@
android:padding="12dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:gravity="center"
android:src="@drawable/ic_bookmark_border_24dp" />
android:src="@drawable/ic_favorite_border_24dp" />
<LinearLayout
android:id="@+id/llNode"

View File

@ -34,4 +34,9 @@
android:title="@string/menu_info"
app:showAsAction="never" />
<item
android:id="@+id/action_rescan"
android:orderInCategory="600"
android:title="@string/menu_rescan"
app:showAsAction="never" />
</menu>

View File

@ -383,4 +383,6 @@
<string name="label_restoreheight">Restablir Alçada</string> <!-- Restore Height -->
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -386,4 +386,6 @@
<string name="label_restoreheight">Wiederherstellungshöhe</string>
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -385,4 +385,6 @@
<string name="label_restoreheight">Ύψος ανάκτησης</string> <!-- "Restore Height" -->
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -385,4 +385,6 @@
<string name="label_restoreheight">Restaŭralteco</string> <!-- Restore Height -->
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -375,4 +375,6 @@
<string name="label_restoreheight">Altura de Restauración</string> <!-- Restore Height -->
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -383,4 +383,6 @@
<string name="label_restoreheight">Taastamise plokinumber</string> <!-- Restore Height -->
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -389,4 +389,6 @@
<string name="label_restoreheight">Hauteur de restauration</string> <!-- Restore Height -->
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -387,4 +387,6 @@
<string name="label_restoreheight">Visszaállítási lánchossz</string> <!-- Restore Height -->
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -388,4 +388,6 @@
<string name="label_restoreheight">Altezza di ripristino</string> <!-- Restore Height -->
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -394,4 +394,6 @@
<string name="label_restoreheight">Restore Height</string>
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -385,4 +385,6 @@
<string name="label_restoreheight">Restore Height</string>
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -385,4 +385,6 @@
<string name="label_restoreheight">Herstelpunt</string> <!-- Restore Height -->
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -377,4 +377,6 @@
<string name="label_restoreheight">Restaurar da altura</string> <!-- Restore Height -->
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -389,4 +389,6 @@
<string name="label_restoreheight">Restaurar de Altura</string> <!-- Restore Height -->
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -385,4 +385,6 @@
<string name="label_restoreheight">Restaurează Monobloc</string> <!-- Restore Height -->
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -389,4 +389,6 @@
<string name="label_restoreheight">Восстановить высоту</string> <!-- Restore Height -->
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -386,4 +386,6 @@
<string name="label_restoreheight">Výška</string> <!-- Restore Height -->
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -385,4 +385,6 @@
<string name="label_restoreheight">Obnovi visinu</string> <!-- Restore Height -->
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -370,4 +370,6 @@
<string name="label_restoreheight">Återställningshöjd</string> <!-- Restore Height -->
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -389,4 +389,6 @@
<string name="label_restoreheight">Відновити висоту</string> <!-- Restore Height -->
<string name="toast_ledger_start_app">Запуск Monero додатку через %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -307,4 +307,6 @@
<string name="label_restoreheight">Restore Height</string>
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -384,4 +384,6 @@
<string name="label_restoreheight">Restore Height</string>
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -436,4 +436,6 @@
<string name="label_restoreheight">Restore Height</string>
<string name="toast_ledger_start_app">Start Monero App on %1$s</string>
<string name="menu_rescan">Rescan!</string>
</resources>

View File

@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.android.tools.build:gradle:3.6.1'
}
}

View File

@ -400,8 +400,8 @@ struct WalletListener
/**
* @brief called by device when passphrase entry is needed
*/
virtual optional<std::string> onDevicePassphraseRequest(bool on_device) {
if (!on_device) throw std::runtime_error("Not supported");
virtual optional<std::string> onDevicePassphraseRequest(bool & on_device) {
on_device = true;
return optional<std::string>();
}
@ -879,6 +879,14 @@ struct Wallet
*/
virtual void disposeTransaction(PendingTransaction * t) = 0;
/*!
* \brief Estimates transaction fee.
* \param destinations Vector consisting of <address, amount> pairs.
* \return Estimated fee.
*/
virtual uint64_t estimateTransactionFee(const std::vector<std::pair<std::string, uint64_t>> &destinations,
PendingTransaction::Priority priority) const = 0;
/*!
* \brief exportKeyImages - exports key images to file
* \param filename
@ -1085,10 +1093,12 @@ struct WalletManager
* \param nettype Network type
* \param restoreHeight restore from start height
* \param kdf_rounds Number of rounds for key derivation function
* \param seed_offset Seed offset passphrase (optional)
* \return Wallet instance (Wallet::status() needs to be called to check if recovered successfully)
*/
virtual Wallet * recoveryWallet(const std::string &path, const std::string &password, const std::string &mnemonic,
NetworkType nettype = MAINNET, uint64_t restoreHeight = 0, uint64_t kdf_rounds = 1) = 0;
NetworkType nettype = MAINNET, uint64_t restoreHeight = 0, uint64_t kdf_rounds = 1,
const std::string &seed_offset = {}) = 0;
Wallet * recoveryWallet(const std::string &path, const std::string &password, const std::string &mnemonic,
bool testnet = false, uint64_t restoreHeight = 0) // deprecated
{
@ -1283,7 +1293,11 @@ struct WalletManager
virtual std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const = 0;
//! checks for an update and returns version, hash and url
static std::tuple<bool, std::string, std::string, std::string, std::string> checkUpdates(const std::string &software, std::string subdir);
static std::tuple<bool, std::string, std::string, std::string, std::string> checkUpdates(
const std::string &software,
std::string subdir,
const char *buildtag = nullptr,
const char *current_version = nullptr);
};

View File

@ -7,7 +7,7 @@ source script/env.sh
cd $EXTERNAL_LIBS_BUILD_ROOT
url="https://github.com/m2049r/monero"
version="release-v0.15-monerujo"
version="release-v0.16.0.0-monerujo"
if [ ! -d "monero" ]; then
git clone ${url} -b ${version}

View File

@ -1,6 +1,6 @@
#Sat Nov 09 21:47:30 CET 2019
#Sat Feb 29 10:39:20 CET 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip