diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2012-12-14 19:16:10 +0100 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2012-12-14 19:16:10 +0100 |
commit | a9d80902f4dbcee2379ba9d7d8cbc829f109f96d (patch) | |
tree | 4f4e9aa9646fcefa4b4b54326f420ed22e88fb7a /APG-API-Lib/src | |
parent | be4e3a10b008dfb33caf593b6e68bb7018c2a41c (diff) | |
download | open-keychain-a9d80902f4dbcee2379ba9d7d8cbc829f109f96d.tar.gz open-keychain-a9d80902f4dbcee2379ba9d7d8cbc829f109f96d.tar.bz2 open-keychain-a9d80902f4dbcee2379ba9d7d8cbc829f109f96d.zip |
cleanup, add SCAN_QR_CODE intent
Diffstat (limited to 'APG-API-Lib/src')
-rw-r--r-- | APG-API-Lib/src/org/thialfihar/android/apg/integration/ApgIntentHelper.java | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/APG-API-Lib/src/org/thialfihar/android/apg/integration/ApgIntentHelper.java b/APG-API-Lib/src/org/thialfihar/android/apg/integration/ApgIntentHelper.java index cbd438f2f..c92f2ebed 100644 --- a/APG-API-Lib/src/org/thialfihar/android/apg/integration/ApgIntentHelper.java +++ b/APG-API-Lib/src/org/thialfihar/android/apg/integration/ApgIntentHelper.java @@ -53,11 +53,23 @@ public class ApgIntentHelper { public static final String ACTION_DECRYPT_STREAM_AND_RETURN = APG_INTENT_PREFIX + "DECRYPT_STREAM_AND_RETURN"; + /** + * Select keys, without permission + */ public static final String ACTION_SELECT_PUBLIC_KEYS = APG_INTENT_PREFIX + "SELECT_PUBLIC_KEYS"; public static final String ACTION_SELECT_SECRET_KEY = APG_INTENT_PREFIX + "SELECT_SECRET_KEY"; + + /** + * Create key/edit key, without permission + */ public static final String ACTION_CREATE_KEY = APG_INTENT_PREFIX + "CREATE_KEY"; public static final String ACTION_EDIT_KEY = APG_INTENT_PREFIX + "EDIT_KEY"; + /** + * Scan QR code, without permission + */ + public static final String ACTION_SCAN_QR_CODE = APG_INTENT_PREFIX + "SCAN_QR_CODE"; + public static final String EXTRA_TEXT = "text"; public static final String EXTRA_DATA = "data"; public static final String EXTRA_ERROR = "error"; @@ -80,7 +92,7 @@ public class ApgIntentHelper { public static final String RESULT_EXTRA_MASTER_KEY_IDS = "masterKeyIds"; public static final String RESULT_EXTRA_USER_IDS = "userIds"; - + // result from EditKey public static final String RESULT_EXTRA_MASTER_KEY_ID = "masterKeyId"; public static final String RESULT_EXTRA_USER_ID = "userId"; @@ -101,6 +113,23 @@ public class ApgIntentHelper { } /** + * Open activity to scan qr code and import key in it + * + * @return true when activity was found and executed successfully + */ + public boolean scanQrCode() { + Intent intent = new Intent(ACTION_SCAN_QR_CODE); + intent.putExtra(EXTRA_INTENT_VERSION, INTENT_VERSION); + try { + activity.startActivityForResult(intent, -1); + return true; + } catch (ActivityNotFoundException e) { + activityNotFound(); + return false; + } + } + + /** * Opens APG activity to create new key * * @param userIds |