From a9d80902f4dbcee2379ba9d7d8cbc829f109f96d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 14 Dec 2012 19:16:10 +0100 Subject: cleanup, add SCAN_QR_CODE intent --- .../android/apg/integration/ApgIntentHelper.java | 31 +++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'APG-API-Lib/src') 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"; @@ -100,6 +112,23 @@ public class ApgIntentHelper { this.activity = activity; } + /** + * 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 * -- cgit v1.2.3