aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorJohannes Baiter <johannes.baiter@gmail.com>2014-10-29 11:14:32 +0100
committerJohannes Baiter <johannes.baiter@gmail.com>2014-10-29 11:14:32 +0100
commit9822c097cb276aecae3ffa954b5551a5a08de83e (patch)
treec6633c826257e903a2c616fc7980e537c9845932 /app/src/main/java
parent9aea6560b0b66285c7c1c47fed828c22514d9e2b (diff)
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.java17
1 files changed, 10 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..5397e026 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,7 @@ public class PgpHandler extends ActionBarActivity implements OpenPgpServiceConne
.setText(extraContent);
}
new DelayShow().execute();
+ copyToClipBoard();
} else {
showToast(os.toString());
}