diff options
author | Mohamed Zenadi <mohamed.zenadi@gmail.com> | 2014-10-29 12:38:11 +0100 |
---|---|---|
committer | Mohamed Zenadi <mohamed.zenadi@gmail.com> | 2014-10-29 12:38:11 +0100 |
commit | 021bec9f92ede8777930d400e27eacc37e5c1266 (patch) | |
tree | 0aeaa16e8e8dc02ead3e6411d5a589c072ccc75c /app/src/main/java | |
parent | ad81e9b0dff8fe6b40502604dc615f1eb7e2c54d (diff) | |
parent | 741ce31abb9bcb82262461f9b8ec8101b962e6f0 (diff) |
Merge pull request #23 from jbaiter/copy-on-show
Add option to automatically copy password to clipboard after decryption
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java | 19 |
1 files changed, 12 insertions, 7 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 7c6c0da8..f2908ebd 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java @@ -145,15 +145,19 @@ public class PgpHandler extends ActionBarActivity implements OpenPgpServiceConne finish(); return true; case R.id.copy_password: - ClipData clip = ClipData.newPlainText("pgp_handler_result_pm", ((TextView) findViewById(R.id.crypto_password_show)).getText()); - clipboard.setPrimaryClip(clip); - showToast("Password copied to clipboard, you have " - + Integer.parseInt(settings.getString("general_show_time", "45")) - + " seconds to paste it somewhere."); + copyToClipBoard(); } return super.onOptionsItemSelected(item); } + public void copyToClipBoard() { + ClipData clip = ClipData.newPlainText("pgp_handler_result_pm", ((TextView) findViewById(R.id.crypto_password_show)).getText()); + clipboard.setPrimaryClip(clip); + showToast("Password copied to clipboard, you have " + + Integer.parseInt(settings.getString("general_show_time", "45")) + + " seconds to paste it somewhere."); + } + public void handleClick(View view) { switch (view.getId()) { case R.id.crypto_show_button: @@ -313,8 +317,6 @@ public class PgpHandler extends ActionBarActivity implements OpenPgpServiceConne switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR)) { case OpenPgpApi.RESULT_CODE_SUCCESS: { - showToast("SUCCESS"); - // encrypt/decrypt/sign/verify if (requestCode == REQUEST_CODE_DECRYPT_AND_VERIFY && os != null) { try { @@ -336,6 +338,9 @@ public class PgpHandler extends ActionBarActivity implements OpenPgpServiceConne .setText(extraContent); } new DelayShow().execute(); + if (settings.getBoolean("copy_on_decrypt", true)) { + copyToClipBoard(); + } } else { showToast(os.toString()); } |