Skip to content

Commit

Permalink
indent
Browse files Browse the repository at this point in the history
  • Loading branch information
YushraJewon committed May 27, 2024
1 parent d87739f commit 03d77e9
Showing 1 changed file with 22 additions and 23 deletions.
45 changes: 22 additions & 23 deletions src/android/CameraPreviewFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
return containerView;
}


public void startCamera() {
ListenableFuture<ProcessCameraProvider> cameraProviderFuture = ProcessCameraProvider.getInstance(getActivity());

Expand Down Expand Up @@ -481,27 +480,27 @@ public void setUpCamera(String captureDevice, ProcessCameraProvider cameraProvid
imageCapture = new ImageCapture.Builder()
.setTargetResolution(targetResolution)
.build();
cameraProvider.unbindAll();
try {
camera = cameraProvider.bindToLifecycle(
getActivity(),
cameraSelector,
preview,
imageCapture,
videoCapture
);
} catch (IllegalArgumentException e) {
// Error with result in capturing image with default resolution
e.printStackTrace();
imageCapture = new ImageCapture.Builder()
.build();
camera = cameraProvider.bindToLifecycle(
getActivity(),
cameraSelector,
preview,
imageCapture,
videoCapture
);
}
cameraProvider.unbindAll();
try {
camera = cameraProvider.bindToLifecycle(
getActivity(),
cameraSelector,
preview,
imageCapture,
videoCapture
);
} catch (IllegalArgumentException e) {
// Error with result in capturing image with default resolution
e.printStackTrace();
imageCapture = new ImageCapture.Builder()
.build();
camera = cameraProvider.bindToLifecycle(
getActivity(),
cameraSelector,
preview,
imageCapture,
videoCapture
);
}
}
}

0 comments on commit 03d77e9

Please sign in to comment.