mirror of https://github.com/m2049r/xmrwallet.git
random fixes (#747)
This commit is contained in:
parent
1d027c1694
commit
38c0ead45c
|
@ -183,6 +183,7 @@ public class SendAddressWizardFragment extends SendWizardFragment {
|
||||||
selectedCrypto = Crypto.XMR;
|
selectedCrypto = Crypto.XMR;
|
||||||
sendListener.setMode(SendFragment.Mode.XMR);
|
sendListener.setMode(SendFragment.Mode.XMR);
|
||||||
}
|
}
|
||||||
|
if (!Helper.ALLOW_SHIFT) return;
|
||||||
if ((selectedCrypto == null) && isEthAddress(address)) {
|
if ((selectedCrypto == null) && isEthAddress(address)) {
|
||||||
Timber.d("isEthAddress");
|
Timber.d("isEthAddress");
|
||||||
possibleCryptos.add(Crypto.ETH);
|
possibleCryptos.add(Crypto.ETH);
|
||||||
|
@ -465,7 +466,8 @@ public class SendAddressWizardFragment extends SendWizardFragment {
|
||||||
possibleCryptos.add(barcodeData.asset);
|
possibleCryptos.add(barcodeData.asset);
|
||||||
selectedCrypto = barcodeData.asset;
|
selectedCrypto = barcodeData.asset;
|
||||||
}
|
}
|
||||||
updateCryptoButtons(false);
|
if (Helper.ALLOW_SHIFT)
|
||||||
|
updateCryptoButtons(false);
|
||||||
if (checkAddress()) {
|
if (checkAddress()) {
|
||||||
if (barcodeData.security == BarcodeData.Security.OA_NO_DNSSEC)
|
if (barcodeData.security == BarcodeData.Security.OA_NO_DNSSEC)
|
||||||
etAddress.setError(getString(R.string.send_address_no_dnssec));
|
etAddress.setError(getString(R.string.send_address_no_dnssec));
|
||||||
|
|
|
@ -80,6 +80,7 @@ public class Helper {
|
||||||
static public final String NOCRAZYPASS_FLAGFILE = ".nocrazypass";
|
static public final String NOCRAZYPASS_FLAGFILE = ".nocrazypass";
|
||||||
|
|
||||||
static public final String BASE_CRYPTO = Crypto.XMR.getSymbol();
|
static public final String BASE_CRYPTO = Crypto.XMR.getSymbol();
|
||||||
|
static public final int XMR_DECIMALS = 12;
|
||||||
|
|
||||||
static public final boolean SHOW_EXCHANGERATES = true;
|
static public final boolean SHOW_EXCHANGERATES = true;
|
||||||
static public final boolean ALLOW_SHIFT = true;
|
static public final boolean ALLOW_SHIFT = true;
|
||||||
|
@ -159,11 +160,11 @@ public class Helper {
|
||||||
}
|
}
|
||||||
|
|
||||||
static public BigDecimal getDecimalAmount(long amount) {
|
static public BigDecimal getDecimalAmount(long amount) {
|
||||||
return new BigDecimal(amount).scaleByPowerOfTen(-12);
|
return new BigDecimal(amount).scaleByPowerOfTen(-XMR_DECIMALS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static public String getDisplayAmount(long amount) {
|
static public String getDisplayAmount(long amount) {
|
||||||
return getDisplayAmount(amount, 12);
|
return getDisplayAmount(amount, XMR_DECIMALS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static public String getDisplayAmount(long amount, int maxDecimals) {
|
static public String getDisplayAmount(long amount, int maxDecimals) {
|
||||||
|
@ -195,7 +196,7 @@ public class Helper {
|
||||||
static public String getDisplayAmount(double amount) {
|
static public String getDisplayAmount(double amount) {
|
||||||
// a Java bug does not strip zeros properly if the value is 0
|
// a Java bug does not strip zeros properly if the value is 0
|
||||||
BigDecimal d = new BigDecimal(amount)
|
BigDecimal d = new BigDecimal(amount)
|
||||||
.setScale(12, BigDecimal.ROUND_HALF_UP)
|
.setScale(XMR_DECIMALS, BigDecimal.ROUND_HALF_UP)
|
||||||
.stripTrailingZeros();
|
.stripTrailingZeros();
|
||||||
if (d.scale() < 1)
|
if (d.scale() < 1)
|
||||||
d = d.setScale(1, BigDecimal.ROUND_UNNECESSARY);
|
d = d.setScale(1, BigDecimal.ROUND_UNNECESSARY);
|
||||||
|
|
|
@ -53,6 +53,7 @@ public class LegacyStorageHelper {
|
||||||
public void migrate() {
|
public void migrate() {
|
||||||
String addressPrefix = WalletManager.getInstance().addressPrefix();
|
String addressPrefix = WalletManager.getInstance().addressPrefix();
|
||||||
File[] wallets = srcDir.listFiles((dir, filename) -> filename.endsWith(".keys"));
|
File[] wallets = srcDir.listFiles((dir, filename) -> filename.endsWith(".keys"));
|
||||||
|
if (wallets == null) return;
|
||||||
for (File wallet : wallets) {
|
for (File wallet : wallets) {
|
||||||
final String walletName = wallet.getName().substring(0, wallet.getName().length() - ".keys".length());
|
final String walletName = wallet.getName().substring(0, wallet.getName().length() - ".keys".length());
|
||||||
if (addressPrefix.indexOf(getAddress(walletName).charAt(0)) < 0) {
|
if (addressPrefix.indexOf(getAddress(walletName).charAt(0)) < 0) {
|
||||||
|
|
|
@ -30,6 +30,7 @@ import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
import com.m2049r.xmrwallet.R;
|
import com.m2049r.xmrwallet.R;
|
||||||
import com.m2049r.xmrwallet.dialog.HelpFragment;
|
import com.m2049r.xmrwallet.dialog.HelpFragment;
|
||||||
|
import com.m2049r.xmrwallet.ledger.Ledger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -52,12 +53,13 @@ public class Notice {
|
||||||
R.string.help_xmrto,
|
R.string.help_xmrto,
|
||||||
1)
|
1)
|
||||||
);
|
);
|
||||||
notices.add(
|
if (Ledger.ENABLED)
|
||||||
new Notice(NOTICE_SHOW_LEDGER,
|
notices.add(
|
||||||
R.string.info_ledger_enabled,
|
new Notice(NOTICE_SHOW_LEDGER,
|
||||||
R.string.help_create_ledger,
|
R.string.info_ledger_enabled,
|
||||||
1)
|
R.string.help_create_ledger,
|
||||||
);
|
1)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@ import java.util.TimeZone;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class RestoreHeight {
|
public class RestoreHeight {
|
||||||
|
static final int DIFFICULTY_TARGET = 120; // seconds
|
||||||
|
|
||||||
static private RestoreHeight Singleton = null;
|
static private RestoreHeight Singleton = null;
|
||||||
|
|
||||||
static public RestoreHeight getInstance() {
|
static public RestoreHeight getInstance() {
|
||||||
|
@ -190,7 +192,7 @@ public class RestoreHeight {
|
||||||
} else {
|
} else {
|
||||||
long days = TimeUnit.DAYS.convert(query.getTimeInMillis() - prevTime,
|
long days = TimeUnit.DAYS.convert(query.getTimeInMillis() - prevTime,
|
||||||
TimeUnit.MILLISECONDS);
|
TimeUnit.MILLISECONDS);
|
||||||
height = Math.round(prevBc + 1.0 * days * (24 * 60 / 2));
|
height = Math.round(prevBc + 1.0 * days * (24f * 60 * 60 / DIFFICULTY_TARGET));
|
||||||
}
|
}
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue