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 // copy + delete seems safer than rename because we call rollback easily
boolean renameWallet(File walletFile, String newName) { 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); deleteWallet(walletFile);
return true; return true;
} else { } else {
@ -300,7 +300,7 @@ public class LoginActivity extends AppCompatActivity
// TODO probably better to copy to a new file and then rename // TODO probably better to copy to a new file and then rename
// then if something fails we have the old backup at least // then if something fails we have the old backup at least
// or just create a new backup every time and keep n old backups // 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 @Override
@ -767,7 +767,7 @@ public class LoginActivity extends AppCompatActivity
final File newWalletFile = new File(new File(getStorageRoot(), ".new"), name); final File newWalletFile = new File(new File(getStorageRoot(), ".new"), name);
final File walletFolder = getStorageRoot(); final File walletFolder = getStorageRoot();
final File walletFile = new File(walletFolder, name); 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); (testWallet(walletFile.getAbsolutePath(), password) == Wallet.Status.Status_Ok);
if (rc) { 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()); //Log.d(TAG, "src=" + srcWallet.exists() + " dst=" + dstWallet.exists());
if (walletExists(dstWallet, true) && !overwrite) return false; if (walletExists(dstWallet, true) && !overwrite) return false;
if (!walletExists(srcWallet, false)) return false; if (!walletExists(srcWallet, false)) return false;
@ -822,7 +822,13 @@ public class LoginActivity extends AppCompatActivity
File dstDir = dstWallet.getParentFile(); File dstDir = dstWallet.getParentFile();
String dstName = dstWallet.getName(); String dstName = dstWallet.getName();
try { try {
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), new File(dstDir, dstName));
}
copyFile(new File(srcDir, srcName + ".keys"), new File(dstDir, dstName + ".keys")); copyFile(new File(srcDir, srcName + ".keys"), new File(dstDir, dstName + ".keys"));
copyFile(new File(srcDir, srcName + ".address.txt"), new File(dstDir, dstName + ".address.txt")); copyFile(new File(srcDir, srcName + ".address.txt"), new File(dstDir, dstName + ".address.txt"));
success = true; success = true;

View File

@ -95,7 +95,6 @@ public class ReceiveFragment extends Fragment implements AsyncExchangeRate.Liste
// losing precision using double here doesn't matter // losing precision using double here doesn't matter
double amountA = Double.parseDouble(enteredAmount); double amountA = Double.parseDouble(enteredAmount);
double amountB = amountA * rate; double amountB = amountA * rate;
Log.d(TAG, "exchange A=" + amountA + " B=" + amountB);
if (enteredCurrencyA.equals("XMR")) { if (enteredCurrencyA.equals("XMR")) {
String validatedAmountA = Helper.getDisplayAmount(Wallet.getAmountFromString(enteredAmount)); String validatedAmountA = Helper.getDisplayAmount(Wallet.getAmountFromString(enteredAmount));
xmrAmount = validatedAmountA; // take what was entered in XMR 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) { private void generateQr(String xmrAmount) {
Log.d(TAG, "AMOUNT=" + xmrAmount);
String address = tvAddress.getText().toString(); String address = tvAddress.getText().toString();
String paymentId = etPaymentId.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(); StringBuffer sb = new StringBuffer();
sb.append(ScannerFragment.QR_SCHEME).append(address); sb.append(ScannerFragment.QR_SCHEME).append(address);
boolean first = true; boolean first = true;

View File

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

View File

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