diff --git a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java index b5d1de2..75db7c5 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java @@ -557,6 +557,31 @@ public class LoginActivity extends BaseActivity .show(); } + @Override + public void onWalletDeleteCache(final String walletName) { + Timber.d("delete cache for wallet ." + walletName + "."); + if (checkServiceRunning()) return; + DialogInterface.OnClickListener dialogClickListener = (dialog, which) -> { + switch (which) { + case DialogInterface.BUTTON_POSITIVE: + if (!deleteWalletCache(Helper.getWalletFile(LoginActivity.this, walletName))) { + Toast.makeText(LoginActivity.this, getString(R.string.delete_failed), Toast.LENGTH_LONG).show(); + } + break; + case DialogInterface.BUTTON_NEGATIVE: + // do nothing + break; + } + }; + + AlertDialog.Builder builder = new MaterialAlertDialogBuilder(this); + builder.setMessage(getString(R.string.deletecache_alert_message, walletName)) + .setTitle(walletName) + .setPositiveButton(getString(R.string.delete_alert_yes), dialogClickListener) + .setNegativeButton(getString(R.string.delete_alert_no), dialogClickListener) + .show(); + } + void reloadWalletList() { Timber.d("reloadWalletList()"); try { @@ -1024,6 +1049,18 @@ public class LoginActivity extends BaseActivity return success; } + boolean deleteWalletCache(File walletFile) { + Timber.d("deleteWalletCache %s", walletFile.getAbsolutePath()); + File dir = walletFile.getParentFile(); + String name = walletFile.getName(); + boolean success = true; + File cacheFile = new File(dir, name); + if (cacheFile.exists()) { + success = cacheFile.delete(); + } + return success; + } + void copyFile(File src, File dst) throws IOException { try (FileChannel inChannel = new FileInputStream(src).getChannel(); FileChannel outChannel = new FileOutputStream(dst).getChannel()) { diff --git a/app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java b/app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java index 0db596e..34939c8 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java @@ -88,6 +88,8 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter void onWalletDelete(String walletName); + void onWalletDeleteCache(String walletName); + void onAddWallet(String type); void onNodePrefs(); @@ -220,6 +222,8 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter activityCallback.onWalletBackup(listItem.getName()); } else if (id == R.id.action_archive) { activityCallback.onWalletDelete(listItem.getName()); + } else if (id == R.id.action_deletecache) { + activityCallback.onWalletDeleteCache(listItem.getName()); } else { return super.onContextItemSelected(item); } diff --git a/app/src/main/java/com/m2049r/xmrwallet/service/exchange/ecb/ExchangeApiImpl.java b/app/src/main/java/com/m2049r/xmrwallet/service/exchange/ecb/ExchangeApiImpl.java index d743a0a..e424a1b 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/service/exchange/ecb/ExchangeApiImpl.java +++ b/app/src/main/java/com/m2049r/xmrwallet/service/exchange/ecb/ExchangeApiImpl.java @@ -167,7 +167,7 @@ public class ExchangeApiImpl implements ExchangeApi { private Calendar fetchDate = null; synchronized private ExchangeRate getRate(String currency) throws ExchangeException { - Timber.e("Getting %s", currency); + Timber.d("Getting %s", currency); final Double rate = fxEntries.get(currency); if (rate == null) throw new ExchangeException(404, "Currency not supported: " + currency); return new ExchangeRateImpl(currency, rate, fxDate.getTime()); diff --git a/app/src/main/res/menu/list_context_menu.xml b/app/src/main/res/menu/list_context_menu.xml index fda24ce..4e78794 100644 --- a/app/src/main/res/menu/list_context_menu.xml +++ b/app/src/main/res/menu/list_context_menu.xml @@ -26,4 +26,8 @@ android:orderInCategory="500" android:title="@string/menu_info" /> + \ No newline at end of file diff --git a/app/src/main/res/values-cat/strings.xml b/app/src/main/res/values-cat/strings.xml index 6c517c6..10aae1c 100644 --- a/app/src/main/res/values-cat/strings.xml +++ b/app/src/main/res/values-cat/strings.xml @@ -417,10 +417,13 @@ Select a subaddress Long-press for details - The wallet will be deleted! + This wallet will be deleted! Delete Delete failed! Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 851b765..f643e1a 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -424,4 +424,7 @@ Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 34c692a..529cfca 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -419,10 +419,13 @@ Select a subaddress Long-press for details - The wallet will be deleted! + This wallet will be deleted! Delete Delete failed! Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-eo/strings.xml b/app/src/main/res/values-eo/strings.xml index 6237dcf..bd85a3b 100644 --- a/app/src/main/res/values-eo/strings.xml +++ b/app/src/main/res/values-eo/strings.xml @@ -419,10 +419,13 @@ Select a subaddress Long-press for details - The wallet will be deleted! + This wallet will be deleted! Delete Delete failed! Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 7023abe..ebf1bc0 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -416,4 +416,7 @@ Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-et/strings.xml b/app/src/main/res/values-et/strings.xml index 7f265e5..e058a83 100644 --- a/app/src/main/res/values-et/strings.xml +++ b/app/src/main/res/values-et/strings.xml @@ -417,10 +417,13 @@ Select a subaddress Long-press for details - The wallet will be deleted! + This wallet will be deleted! Delete Delete failed! Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 98d688b..d8af4fa 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -429,4 +429,7 @@ Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index bcdbb14..1a8d714 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -421,10 +421,13 @@ Select a subaddress Long-press for details - The wallet will be deleted! + This wallet will be deleted! Delete Delete failed! Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 94b8b02..2322408 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -428,4 +428,7 @@ Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index d5721da..d853b66 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -422,10 +422,13 @@ Select a subaddress Long-press for details - The wallet will be deleted! + This wallet will be deleted! Delete Delete failed! Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 1b2125f..f1e2113 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -419,10 +419,13 @@ Select a subaddress Long-press for details - The wallet will be deleted! + This wallet will be deleted! Delete Delete failed! Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index f99fa2a..2f0f59a 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -425,4 +425,7 @@ Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index e83fe23..576e405 100755 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -411,10 +411,13 @@ Selecione um subendereço Toque e segure para mais detalhes - The wallet will be deleted! + This wallet will be deleted! Delete Delete failed! Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index c9e7046..5259101 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -423,10 +423,13 @@ Select a subaddress Long-press for details - The wallet will be deleted! + This wallet will be deleted! Delete Delete failed! Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 17d0de7..4570066 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -419,10 +419,13 @@ Selectează o subadresă Atinge lung pentru detalii - The wallet will be deleted! + This wallet will be deleted! Delete Delete failed! Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index a10317a..63c9944 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -429,4 +429,7 @@ Импортировать кошелек Ошибка импорта! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index c1895c2..5340de4 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -426,4 +426,7 @@ Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-sr/strings.xml b/app/src/main/res/values-sr/strings.xml index 7733d62..0f5d282 100644 --- a/app/src/main/res/values-sr/strings.xml +++ b/app/src/main/res/values-sr/strings.xml @@ -424,4 +424,7 @@ Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index ea05956..2ac2d44 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -411,10 +411,13 @@ Select a subaddress Long-press for details - The wallet will be deleted! + This wallet will be deleted! Delete Delete failed! Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index df166ff..9cb77ae 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -429,4 +429,7 @@ Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index db38944..3838a3d 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -343,10 +343,13 @@ Select a subaddress Long-press for details - The wallet will be deleted! + This wallet will be deleted! Delete Delete failed! Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 6f48545..4cbe350 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -418,10 +418,13 @@ Select a subaddress Long-press for details - The wallet will be deleted! + This wallet will be deleted! Delete Delete failed! Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load! diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7da9eea..32fb585 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -278,7 +278,7 @@ Take me back! Details - The wallet will be deleted! + This wallet will be deleted! Yes, do that! No thanks! @@ -497,4 +497,7 @@ Import wallet Import failed! + + Reset wallet! + This wallet will be reset, losing all off-chain data (like notes, account & subaddress names, private transaction keys, ...)! Use this ONLY if this wallet is corrupt and does not load!