From 1db4f7bbc31d0e9f24247e4973474d37f12ab72d Mon Sep 17 00:00:00 2001 From: Mohamed Zenadi Date: Wed, 17 Jun 2015 21:18:26 +0200 Subject: [PATCH] Add the option for not showing the passwords after decrypt fixes #90 --- .../com/zeapo/pwdstore/crypto/PgpHandler.java | 33 ++++--- app/src/main/res/values-cs/strings.xml | 3 + app/src/main/res/values/strings.xml | 3 + app/src/main/res/xml/preference.xml | 97 ++++++++++++------- 4 files changed, 88 insertions(+), 48 deletions(-) diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java index 10888ae6..28aea81e 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java @@ -318,22 +318,29 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne if (requestCode == REQUEST_CODE_DECRYPT_AND_VERIFY && os != null) { try { if (returnToCiphertextField) { - findViewById(R.id.crypto_container).setVisibility(View.VISIBLE); - Typeface type = Typeface.createFromAsset(getAssets(), "fonts/sourcecodepro.ttf"); - String[] passContent = os.toString("UTF-8").split("\n"); - ((TextView) findViewById(R.id.crypto_password_show)) - .setTypeface(type); - ((TextView) findViewById(R.id.crypto_password_show)) - .setText(passContent[0]); + boolean showPassword = settings.getBoolean("show_password", true); - String extraContent = os.toString("UTF-8").replaceFirst(".*\n", ""); - if (extraContent.length() != 0) { - ((TextView) findViewById(R.id.crypto_extra_show)) + if (showPassword) { + findViewById(R.id.crypto_container).setVisibility(View.VISIBLE); + Typeface type = Typeface.createFromAsset(getAssets(), "fonts/sourcecodepro.ttf"); + String[] passContent = os.toString("UTF-8").split("\n"); + ((TextView) findViewById(R.id.crypto_password_show)) .setTypeface(type); - ((TextView) findViewById(R.id.crypto_extra_show)) - .setText(extraContent); + ((TextView) findViewById(R.id.crypto_password_show)) + .setText(passContent[0]); + + String extraContent = os.toString("UTF-8").replaceFirst(".*\n", ""); + if (extraContent.length() != 0) { + ((TextView) findViewById(R.id.crypto_extra_show)) + .setTypeface(type); + ((TextView) findViewById(R.id.crypto_extra_show)) + .setText(extraContent); + } + new DelayShow().execute(); + } else { + activity.setResult(RESULT_CANCELED); + activity.finish(); } - new DelayShow().execute(); if (settings.getBoolean("copy_on_decrypt", true)) { copyToClipBoard(); } diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 3e8f2d71..e41cda98 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -124,5 +124,8 @@ Synchronize repository Pull from remote Push to remote + Show the password + Control the visibility of the passwords once decrypted, this does not disable the password copy + Password copied into the clipboard diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 36ecb1d8..a8db99ff 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -125,5 +125,8 @@ Synchronize repository Pull from remote Push to remote + Show the password + Control the visibility of the passwords once decrypted, this does not disable the password copy + Password copied into the clipboard diff --git a/app/src/main/res/xml/preference.xml b/app/src/main/res/xml/preference.xml index d9d4603d..1ddcde41 100644 --- a/app/src/main/res/xml/preference.xml +++ b/app/src/main/res/xml/preference.xml @@ -1,40 +1,67 @@ - - - - - - - - + + + + + + + + - - - - - + + + + + - - - - - + + + + + + \ No newline at end of file