This commit is contained in:
m2049r 2017-09-09 22:02:17 +02:00
parent 5c1fa097a9
commit b8c287b763
4 changed files with 17 additions and 15 deletions

View File

@ -196,7 +196,7 @@ public class LoginActivity extends AppCompatActivity
// copy + delete seems safer than rename because we call rollback easily
boolean renameWallet(File walletFile, String newName) {
if (copyWallet(walletFile, new File(walletFile.getParentFile(), newName), false)) {
if (copyWallet(walletFile, new File(walletFile.getParentFile(), newName), false, true)) {
deleteWallet(walletFile);
return true;
} else {
@ -300,7 +300,7 @@ public class LoginActivity extends AppCompatActivity
// TODO probably better to copy to a new file and then rename
// then if something fails we have the old backup at least
// or just create a new backup every time and keep n old backups
return copyWallet(walletFile, backupFile, true);
return copyWallet(walletFile, backupFile, true, true);
}
@Override
@ -767,7 +767,7 @@ public class LoginActivity extends AppCompatActivity
final File newWalletFile = new File(new File(getStorageRoot(), ".new"), name);
final File walletFolder = getStorageRoot();
final File walletFile = new File(walletFolder, name);
final boolean rc = copyWallet(newWalletFile, walletFile, false)
final boolean rc = copyWallet(newWalletFile, walletFile, false, false)
&&
(testWallet(walletFile.getAbsolutePath(), password) == Wallet.Status.Status_Ok);
if (rc) {
@ -811,7 +811,7 @@ public class LoginActivity extends AppCompatActivity
}
}
boolean copyWallet(File srcWallet, File dstWallet, boolean overwrite) {
boolean copyWallet(File srcWallet, File dstWallet, boolean overwrite, boolean full) {
//Log.d(TAG, "src=" + srcWallet.exists() + " dst=" + dstWallet.exists());
if (walletExists(dstWallet, true) && !overwrite) return false;
if (!walletExists(srcWallet, false)) return false;
@ -822,7 +822,13 @@ public class LoginActivity extends AppCompatActivity
File dstDir = dstWallet.getParentFile();
String dstName = dstWallet.getName();
try {
copyFile(new File(srcDir, srcName), new File(dstDir, dstName));
if (full) {
// the cache is corrupt if we recover (!!) from seed
// the cache is ok if we immediately do a full refresh()
// recoveryheight is ignored but not on watchonly wallet ?! - find out why
// so we just ignore the cache file and rebuild it on first sync
copyFile(new File(srcDir, srcName), new File(dstDir, dstName));
}
copyFile(new File(srcDir, srcName + ".keys"), new File(dstDir, dstName + ".keys"));
copyFile(new File(srcDir, srcName + ".address.txt"), new File(dstDir, dstName + ".address.txt"));
success = true;

View File

@ -95,7 +95,6 @@ public class ReceiveFragment extends Fragment implements AsyncExchangeRate.Liste
// losing precision using double here doesn't matter
double amountA = Double.parseDouble(enteredAmount);
double amountB = amountA * rate;
Log.d(TAG, "exchange A=" + amountA + " B=" + amountB);
if (enteredCurrencyA.equals("XMR")) {
String validatedAmountA = Helper.getDisplayAmount(Wallet.getAmountFromString(enteredAmount));
xmrAmount = validatedAmountA; // take what was entered in XMR
@ -352,12 +351,8 @@ public class ReceiveFragment extends Fragment implements AsyncExchangeRate.Liste
}
private void generateQr(String xmrAmount) {
Log.d(TAG, "AMOUNT=" + xmrAmount);
String address = tvAddress.getText().toString();
String paymentId = etPaymentId.getText().toString();
// String enteredAmount = etAmount.getText().toString();
// that's a lot of converting ...
//String amount = (xmrAmount.isEmpty() ? xmrAmount : Helper.getDisplayAmount(Wallet.getAmountFromString(xmrAmount)));
StringBuffer sb = new StringBuffer();
sb.append(ScannerFragment.QR_SCHEME).append(address);
boolean first = true;

View File

@ -51,10 +51,11 @@
android:id="@+id/tvBlockHeightProgress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="8sp"
android:gravity="right"
android:text="Loading..."
android:textSize="12sp"
android:visibility="gone" />
android:visibility="visible" />
<TextView
android:id="@+id/tvBalance"

View File

@ -2,15 +2,15 @@
<resources>
<color name="tx_green">#5C8447</color>
<color name="tx_red">#AC2527</color>
<color name="tx_pending">#4c4c4c</color>
<color name="tx_pending">#e2e2e2</color>
<color name="tx_failed">#FF80AB</color>
<color name="moneroOrange">#ff6600</color>
<color name="moneroWhite">#ffffff</color>
<color name="moneroOrange">#cc5100</color>
<color name="moneroWhite">#e2e2e2</color>
<color name="moneroBlack">#000000</color>
<color name="moneroGray">#4c4c4c</color>
<color name="colorPrimary">#ff6600</color>
<color name="colorPrimary">#cc5100</color>
<color name="colorPrimaryDark">#61221A</color>
<color name="textColorPrimary">#dcdcdc</color>
<color name="windowBackground">#ffffff</color>