From be97da671cd5d0332d317d5c098ccc37a6fb25b1 Mon Sep 17 00:00:00 2001 From: Anurag Das Date: Fri, 23 Feb 2018 15:44:02 +0530 Subject: [PATCH] wpadebug: Add activity to select method for QR Code scanning Add QrCodeReadActivity that makes a decision to select between InputUri and QrCodeScannerActivity depending on the availability of the camera in the device. Signed-off-by: Jouni Malinen --- wpadebug/AndroidManifest.xml | 5 +++ .../w1/fi/wpadebug/QrCodeReadActivity.java | 40 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 wpadebug/src/w1/fi/wpadebug/QrCodeReadActivity.java diff --git a/wpadebug/AndroidManifest.xml b/wpadebug/AndroidManifest.xml index 6c7157af5..3c8b9b988 100644 --- a/wpadebug/AndroidManifest.xml +++ b/wpadebug/AndroidManifest.xml @@ -59,6 +59,11 @@ android:label="Input URI" android:parentActivityName="w1.fi.wpadebug.MainActivity"> + + 0) { + Log.e(TAG, "Number of cameras found: " + numberOfCameras); + Intent QrCodeScanIntent = new Intent(QrCodeReadActivity.this, + QrCodeScannerActivity.class); + QrCodeReadActivity.this.startActivity(QrCodeScanIntent); + finish(); + } else { + Log.e(TAG, "No cameras found, input the QR Code"); + Intent QrCodeInputIntent = new Intent(QrCodeReadActivity.this, + InputUri.class); + QrCodeReadActivity.this.startActivity(QrCodeInputIntent); + finish(); + } + } +}