diff options
author | Mohamed Zenadi <mohamed@zenadi.com> | 2015-06-17 21:18:26 +0200 |
---|---|---|
committer | Mohamed Zenadi <mohamed@zenadi.com> | 2015-06-17 21:18:26 +0200 |
commit | 1db4f7bbc31d0e9f24247e4973474d37f12ab72d (patch) | |
tree | 05dda1938b72db7eed2d741a33cc22d9f1cf7dfd | |
parent | bfdccf4d920f5172a3d88ac0358e0b06ad5fe520 (diff) |
Add the option for not showing the passwords after decrypt
fixes #90
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java | 35 | ||||
-rw-r--r-- | app/src/main/res/values-cs/strings.xml | 3 | ||||
-rw-r--r-- | app/src/main/res/values/strings.xml | 3 | ||||
-rw-r--r-- | app/src/main/res/xml/preference.xml | 97 |
4 files changed, 89 insertions, 49 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]); - - String extraContent = os.toString("UTF-8").replaceFirst(".*\n", ""); - if (extraContent.length() != 0) { - ((TextView) findViewById(R.id.crypto_extra_show)) + boolean showPassword = settings.getBoolean("show_password", true); + + 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 @@ <string name="git_sync">Synchronize repository</string> <string name="git_pull">Pull from remote</string> <string name="git_push">Push to remote</string> + <string name="show_password_pref_title">Show the password</string> + <string name="show_password_pref_summary">Control the visibility of the passwords once decrypted, this does not disable the password copy</string> + <string name="toast_password_copied">Password copied into the clipboard</string> </resources> 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 @@ <string name="git_sync">Synchronize repository</string> <string name="git_pull">Pull from remote</string> <string name="git_push">Push to remote</string> + <string name="show_password_pref_title">Show the password</string> + <string name="show_password_pref_summary">Control the visibility of the passwords once decrypted, this does not disable the password copy</string> + <string name="toast_password_copied">Password copied into the clipboard</string> </resources> 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 @@ <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> - <PreferenceCategory android:title="@string/pref_git_title"> - <Preference android:title="@string/pref_edit_server_info" android:key="git_server_info"/> - <Preference android:title="@string/pref_ssh_title" android:key="ssh_key" /> - <Preference android:title="@string/pref_git_delete_repo" android:key="git_delete_repo" - android:summary="Deletes local repository"/> - <CheckBoxPreference android:title="External repository" android:key="git_external" - android:summary="Use an external password repository"/> - <Preference android:title="Select external repository" android:key="pref_select_external" - android:dependency="git_external"/> - <CheckBoxPreference android:title="Enable git" android:key="git_enabled" - android:summary="Enable Git" android:enabled="false"/> - </PreferenceCategory> + <PreferenceCategory android:title="@string/pref_git_title"> + <Preference + android:key="git_server_info" + android:title="@string/pref_edit_server_info" /> + <Preference + android:key="ssh_key" + android:title="@string/pref_ssh_title" /> + <Preference + android:key="git_delete_repo" + android:summary="Deletes local repository" + android:title="@string/pref_git_delete_repo" /> + <CheckBoxPreference + android:key="git_external" + android:summary="Use an external password repository" + android:title="External repository" /> + <Preference + android:dependency="git_external" + android:key="pref_select_external" + android:title="Select external repository" /> + <CheckBoxPreference + android:enabled="false" + android:key="git_enabled" + android:summary="Enable Git" + android:title="Enable git" /> + </PreferenceCategory> - <PreferenceCategory android:title="@string/pref_crypto_title"> - <org.openintents.openpgp.util.OpenPgpAppPreference - android:key="openpgp_provider_list" android:title="@string/pref_provider_title" /> - <org.openintents.openpgp.util.OpenPgpKeyPreference - android:key="openpgp_key" android:title="Select key" - android:enabled="false"/> - <Preference android:title="@string/pref_key_title" - android:key="openpgp_key_id_pref" /> - </PreferenceCategory> + <PreferenceCategory android:title="@string/pref_crypto_title"> + <org.openintents.openpgp.util.OpenPgpAppPreference + android:key="openpgp_provider_list" + android:title="@string/pref_provider_title" /> + <org.openintents.openpgp.util.OpenPgpKeyPreference + android:enabled="false" + android:key="openpgp_key" + android:title="Select key" /> + <Preference + android:key="openpgp_key_id_pref" + android:title="@string/pref_key_title" /> + </PreferenceCategory> - <PreferenceCategory android:title="@string/pref_general_title"> - <EditTextPreference android:title="@string/pref_password_title" - android:dialogTitle="@string/pref_password_dialog_title" - android:summary="@string/pref_password_dialog_title" - android:defaultValue="45" android:key="general_show_time" - android:inputType="number" /> - <CheckBoxPreference android:title="@string/pref_copy_title" - android:dialogTitle="@string/pref_copy_dialog_title" - android:summary="@string/pref_copy_dialog_title" - android:key="copy_on_decrypt" android:defaultValue="true" /> - <CheckBoxPreference android:title="@string/pref_recursive_filter" - android:summary="@string/pref_recursive_filter_hint" - android:key="filter_recursively" android:defaultValue="true"/> - </PreferenceCategory> + <PreferenceCategory android:title="@string/pref_general_title"> + <EditTextPreference + android:defaultValue="45" + android:dialogTitle="@string/pref_password_dialog_title" + android:inputType="number" + android:key="general_show_time" + android:summary="@string/pref_password_dialog_title" + android:title="@string/pref_password_title" /> + <CheckBoxPreference + android:defaultValue="true" + android:title="@string/show_password_pref_title" + android:summary="@string/show_password_pref_summary" + android:key="show_password" /> + <CheckBoxPreference + android:defaultValue="true" + android:dialogTitle="@string/pref_copy_dialog_title" + android:key="copy_on_decrypt" + android:summary="@string/pref_copy_dialog_title" + android:title="@string/pref_copy_title" /> + <CheckBoxPreference + android:defaultValue="true" + android:key="filter_recursively" + android:summary="@string/pref_recursive_filter_hint" + android:title="@string/pref_recursive_filter" /> + </PreferenceCategory> </PreferenceScreen>
\ No newline at end of file |