Loading app/src/main/java/net/sourceforge/opencamera/MainActivity.java +57 −34 Original line number Diff line number Diff line Loading @@ -403,12 +403,14 @@ public class MainActivity extends AppCompatActivity { getWindow().setAttributes(layout); } if (getResources().getBoolean(R.bool.zoom_level_switch_supported)) { cameraManager = (CameraManager) getSystemService(Context.CAMERA_SERVICE); camerafinder = new CameraFinder(cameraManager); cameraModel = camerafinder.getCameraModels(); cameraIdentifier = new CameraIdentifier(cameraModel); camerafinder.init(); cameraIdentifier.init(); } // Setup multi-camera buttons (must be done after creating preview so we know which Camera API is being used, // and before initialising on-screen visibility). Loading @@ -422,7 +424,6 @@ public class MainActivity extends AppCompatActivity { int n_cameras = preview.getCameraControllerManager().getNumberOfCameras(); if (getResources().getBoolean(R.bool.zoom_level_switch_supported)) { n_cameras = camerafinder.getAllCameraIdList().size(); } if( n_cameras > 2 ) { this.back_camera_ids = new ArrayList<>(); this.front_camera_ids = new ArrayList<>(); Loading Loading @@ -456,6 +457,28 @@ public class MainActivity extends AppCompatActivity { } } } } } else if (n_cameras > 2) { this.back_camera_ids = new ArrayList<>(); this.front_camera_ids = new ArrayList<>(); this.other_camera_ids = new ArrayList<>(); for (int i = 0; i < n_cameras; i++) { switch (preview.getCameraControllerManager().getFacing(i)) { case FACING_BACK: back_camera_ids.add(i); break; case FACING_FRONT: front_camera_ids.add(i); break; default: // we assume any unknown cameras are also external other_camera_ids.add(i); break; } } } if (n_cameras > 2) { if( MyDebug.LOG ) { Log.d(TAG, "back_camera_ids: " + back_camera_ids); Log.d(TAG, "front_camera_ids: " + front_camera_ids); Loading app/src/main/res/values/config.xml +1 −1 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <resources> <bool name="zoom_level_switch_supported">false</bool> <bool name="allow_logical_camera_ids">false</bool> <bool name="allow_logical_camera_ids">true</bool> <!-- An array of (0: back camera / 1: front camera, approximate zoom ratio). These values will be added to the lens switcher if one or more cameras uses the Loading Loading
app/src/main/java/net/sourceforge/opencamera/MainActivity.java +57 −34 Original line number Diff line number Diff line Loading @@ -403,12 +403,14 @@ public class MainActivity extends AppCompatActivity { getWindow().setAttributes(layout); } if (getResources().getBoolean(R.bool.zoom_level_switch_supported)) { cameraManager = (CameraManager) getSystemService(Context.CAMERA_SERVICE); camerafinder = new CameraFinder(cameraManager); cameraModel = camerafinder.getCameraModels(); cameraIdentifier = new CameraIdentifier(cameraModel); camerafinder.init(); cameraIdentifier.init(); } // Setup multi-camera buttons (must be done after creating preview so we know which Camera API is being used, // and before initialising on-screen visibility). Loading @@ -422,7 +424,6 @@ public class MainActivity extends AppCompatActivity { int n_cameras = preview.getCameraControllerManager().getNumberOfCameras(); if (getResources().getBoolean(R.bool.zoom_level_switch_supported)) { n_cameras = camerafinder.getAllCameraIdList().size(); } if( n_cameras > 2 ) { this.back_camera_ids = new ArrayList<>(); this.front_camera_ids = new ArrayList<>(); Loading Loading @@ -456,6 +457,28 @@ public class MainActivity extends AppCompatActivity { } } } } } else if (n_cameras > 2) { this.back_camera_ids = new ArrayList<>(); this.front_camera_ids = new ArrayList<>(); this.other_camera_ids = new ArrayList<>(); for (int i = 0; i < n_cameras; i++) { switch (preview.getCameraControllerManager().getFacing(i)) { case FACING_BACK: back_camera_ids.add(i); break; case FACING_FRONT: front_camera_ids.add(i); break; default: // we assume any unknown cameras are also external other_camera_ids.add(i); break; } } } if (n_cameras > 2) { if( MyDebug.LOG ) { Log.d(TAG, "back_camera_ids: " + back_camera_ids); Log.d(TAG, "front_camera_ids: " + front_camera_ids); Loading
app/src/main/res/values/config.xml +1 −1 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <resources> <bool name="zoom_level_switch_supported">false</bool> <bool name="allow_logical_camera_ids">false</bool> <bool name="allow_logical_camera_ids">true</bool> <!-- An array of (0: back camera / 1: front camera, approximate zoom ratio). These values will be added to the lens switcher if one or more cameras uses the Loading