diff --git a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java index ea9ada6a..5bfc9f6b 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java @@ -99,19 +99,40 @@ public class LoginActivity extends AppCompatActivity } @Override - public void onWalletDetails(String walletName) { + public void onWalletDetails(final String walletName) { Log.d(TAG, "details for wallet ." + walletName + "."); - final File walletFile = Helper.getWalletFile(this, walletName); - if (WalletManager.getInstance().walletExists(walletFile)) { - promptPassword(walletName, new PasswordAction() { - @Override - public void action(String walletName, String password) { - startDetails(walletFile, password, GenerateReviewFragment.VIEW_DETAILS); + + DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + switch (which) { + case DialogInterface.BUTTON_POSITIVE: + final File walletFile = Helper.getWalletFile(LoginActivity.this, walletName); + if (WalletManager.getInstance().walletExists(walletFile)) { + promptPassword(walletName, new PasswordAction() { + @Override + public void action(String walletName, String password) { + startDetails(walletFile, password, GenerateReviewFragment.VIEW_DETAILS); + } + }); + } else { // this cannot really happen as we prefilter choices + Log.e(TAG, "Wallet missing: " + walletName); + Toast.makeText(LoginActivity.this, getString(R.string.bad_wallet), Toast.LENGTH_SHORT).show(); + } + break; + + case DialogInterface.BUTTON_NEGATIVE: + // do nothing + break; } - }); - } else { // this cannot really happen as we prefilter choices - Toast.makeText(this, getString(R.string.bad_wallet), Toast.LENGTH_SHORT).show(); - } + } + }; + + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setMessage(getString(R.string.details_alert_message)) + .setPositiveButton(getString(R.string.details_alert_yes), dialogClickListener) + .setNegativeButton(getString(R.string.details_alert_no), dialogClickListener) + .show(); } @Override diff --git a/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java b/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java index 6690bad9..fc9f340e 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java @@ -16,8 +16,10 @@ package com.m2049r.xmrwallet; +import android.app.AlertDialog; import android.content.ComponentName; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; import android.content.ServiceConnection; import android.content.pm.PackageManager; @@ -585,9 +587,27 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment. } private void onWalletDetails() { - Bundle extras = new Bundle(); - extras.putString("type", GenerateReviewFragment.VIEW_WALLET); - replaceFragment(new GenerateReviewFragment(), null, extras); + DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + switch (which) { + case DialogInterface.BUTTON_POSITIVE: + Bundle extras = new Bundle(); + extras.putString("type", GenerateReviewFragment.VIEW_WALLET); + replaceFragment(new GenerateReviewFragment(), null, extras); + break; + case DialogInterface.BUTTON_NEGATIVE: + // do nothing + break; + } + } + }; + + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setMessage(getString(R.string.details_alert_message)) + .setPositiveButton(getString(R.string.details_alert_yes), dialogClickListener) + .setNegativeButton(getString(R.string.details_alert_no), dialogClickListener) + .show(); } @Override diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 75ff392f..c6acb102 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -159,6 +159,10 @@ Amount (optional) + Sensitive data will now be shown.\nLook over your shoulder! + I\'m safe + Take me back! + 999999.999999999999