From 2fd688bd27431bb60248701f43dbab0fcec4f0c2 Mon Sep 17 00:00:00 2001 From: knuthy Date: Mon, 29 Sep 2014 22:04:47 +0200 Subject: show toast on copy and dismiss dialog if error on openkeychain --- app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java | 12 ++++++++++++ app/src/main/res/layout/decrypt_layout.xml | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) 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 78902d8a..efeabc3e 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java @@ -147,6 +147,9 @@ public class PgpHandler extends Activity implements OpenPgpServiceConnection.OnB 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."); } return super.onOptionsItemSelected(item); } @@ -387,10 +390,19 @@ public class PgpHandler extends Activity implements OpenPgpServiceConnection.OnB break; } case OpenPgpApi.RESULT_CODE_ERROR: { + // TODO show what kind of error it is + /* For example: + * No suitable key found -> no key in OpenKeyChain + * + * Check in open-pgp-lib how their definitions and error code + */ showToast("ERROR"); OpenPgpError error = result.getParcelableExtra(OpenPgpApi.RESULT_ERROR); handleError(error); + + // close the dialog + bindingDialog.dismiss(); break; } diff --git a/app/src/main/res/layout/decrypt_layout.xml b/app/src/main/res/layout/decrypt_layout.xml index 300e1d49..6169dd19 100644 --- a/app/src/main/res/layout/decrypt_layout.xml +++ b/app/src/main/res/layout/decrypt_layout.xml @@ -77,7 +77,7 @@