diff --git a/app/src/main/java/net/sourceforge/opencamera/MainActivity.java b/app/src/main/java/net/sourceforge/opencamera/MainActivity.java index 7ae06d028592520b9e4413851c052086f18a7288..b163eb747e9d1c369a6a660ea36ef180f020b489 100644 --- a/app/src/main/java/net/sourceforge/opencamera/MainActivity.java +++ b/app/src/main/java/net/sourceforge/opencamera/MainActivity.java @@ -435,6 +435,11 @@ public class MainActivity extends AppCompatActivity { cameraIdentifier.init(); } + String[] ignoredCameraIDs = getResources().getStringArray(R.array.config_ignoredCameraIds); + if( MyDebug.LOG ) { + Log.d(TAG, "ignoredCameraIDs: " + Arrays.toString(ignoredCameraIDs)); + } + // 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). // We only allow the separate icon for switching cameras if: @@ -462,6 +467,9 @@ public class MainActivity extends AppCompatActivity { } for(String cameraId: camerafinder.getAllCameraIdList()) { + if (Arrays.stream(ignoredCameraIDs).anyMatch(id -> id.equals(cameraId))) { + continue; + } int id = Integer.parseInt(cameraId); cameraCharacteristics = camerafinder.getCameraCharacteristics(id); Integer facing = cameraCharacteristics.get(CameraCharacteristics.LENS_FACING); @@ -486,6 +494,10 @@ public class MainActivity extends AppCompatActivity { this.front_camera_ids = new ArrayList<>(); this.other_camera_ids = new ArrayList<>(); for (int i = 0; i < n_cameras; i++) { + String currentCameraID = String.valueOf(i); + if (Arrays.stream(ignoredCameraIDs).anyMatch(id -> id.equals(currentCameraID))) { + continue; + } switch (preview.getCameraControllerManager().getFacing(i)) { case FACING_BACK: back_camera_ids.add(i); diff --git a/app/src/main/res/values/config.xml b/app/src/main/res/values/config.xml index 8a88dcd2443a21a4d7d151192575d15bb4be4b3e..05cdb8261dcd8594014db37c8a8b4c0c3ecc5d11 100644 --- a/app/src/main/res/values/config.xml +++ b/app/src/main/res/values/config.xml @@ -17,4 +17,9 @@ + + + + +