]> Pileus Git - ~andy/freeotp/commitdiff
Use first camera if no back camera is present
authorNathaniel McCallum <npmccallum@redhat.com>
Mon, 16 Dec 2013 17:46:50 +0000 (12:46 -0500)
committerNathaniel McCallum <npmccallum@redhat.com>
Mon, 16 Dec 2013 17:46:50 +0000 (12:46 -0500)
AndroidManifest.xml
src/org/fedorahosted/freeotp/CameraDialogFragment.java

index 6d2426f30071802b312b251326e609a6becc683a..3a5b842580291777509858ecd3c6d9efc7e382b5 100644 (file)
@@ -21,7 +21,7 @@
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="org.fedorahosted.freeotp"
-    android:versionCode="10"
+    android:versionCode="11"
     android:versionName="1.3" >
 
     <uses-sdk
index 1e48159d177b7b3d4dcc266807cc91735a6218b9..80c6c9bc6eb24ee0fac4bdba6838017a0ba7dfca 100644 (file)
@@ -52,9 +52,9 @@ public class CameraDialogFragment extends BaseAlertDialogFragment
                super(R.string.scan_qr_code, R.layout.camera,
                        android.R.string.cancel, R.string.manual_entry, 0);
 
-               // Find a back-facing camera
+               // Find a back-facing camera, otherwise use the first camera.
                int cameraId;
-               for (cameraId = Camera.getNumberOfCameras() - 1; cameraId >= 0; cameraId--) {
+               for (cameraId = Camera.getNumberOfCameras() - 1; cameraId > 0; cameraId--) {
                        Camera.getCameraInfo(cameraId, mCameraInfo);
                        if (mCameraInfo.facing == CameraInfo.CAMERA_FACING_BACK)
                                break;
@@ -77,7 +77,7 @@ public class CameraDialogFragment extends BaseAlertDialogFragment
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
 
-               // If we have no back facing camera, open the manual dialog
+               // If we have no cameras, open the manual dialog
                if (mCameraId < 0) {
                        new ManualDialogFragment().show(getFragmentManager(),
                                        ManualDialogFragment.FRAGMENT_TAG);