@capgo/camera-preview 7.23.11 → 7.23.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -521,13 +521,13 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
521
521
  Log.d(
522
522
  TAG,
523
523
  "Container position - Left: " +
524
- previewContainer.getLeft() +
525
- ", Top: " +
526
- previewContainer.getTop() +
527
- ", Right: " +
528
- previewContainer.getRight() +
529
- ", Bottom: " +
530
- previewContainer.getBottom()
524
+ previewContainer.getLeft() +
525
+ ", Top: " +
526
+ previewContainer.getTop() +
527
+ ", Right: " +
528
+ previewContainer.getRight() +
529
+ ", Bottom: " +
530
+ previewContainer.getBottom()
531
531
  );
532
532
  Log.d(TAG, "Container size - Width: " + previewContainer.getWidth() + ", Height: " + previewContainer.getHeight());
533
533
 
@@ -589,32 +589,32 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
589
589
  Log.d(
590
590
  TAG,
591
591
  "Screen dimensions - Pixels: " +
592
- screenWidthPx +
593
- "x" +
594
- screenHeightPx +
595
- ", DP: " +
596
- screenWidthDp +
597
- "x" +
598
- screenHeightDp +
599
- ", Density: " +
600
- density
592
+ screenWidthPx +
593
+ "x" +
594
+ screenHeightPx +
595
+ ", DP: " +
596
+ screenWidthDp +
597
+ "x" +
598
+ screenHeightDp +
599
+ ", Density: " +
600
+ density
601
601
  );
602
602
  Log.d(TAG, "WebView dimensions: " + webViewWidth + "x" + webViewHeight);
603
603
  Log.d(TAG, "Parent dimensions: " + parentWidth + "x" + parentHeight);
604
604
  Log.d(
605
605
  TAG,
606
606
  "SessionConfig values - x:" +
607
- x +
608
- " y:" +
609
- y +
610
- " width:" +
611
- width +
612
- " height:" +
613
- height +
614
- " aspectRatio:" +
615
- aspectRatio +
616
- " isCentered:" +
617
- sessionConfig.isCentered()
607
+ x +
608
+ " y:" +
609
+ y +
610
+ " width:" +
611
+ width +
612
+ " height:" +
613
+ height +
614
+ " aspectRatio:" +
615
+ aspectRatio +
616
+ " isCentered:" +
617
+ sessionConfig.isCentered()
618
618
  );
619
619
 
620
620
  // Apply aspect ratio if specified
@@ -684,13 +684,13 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
684
684
  Log.d(
685
685
  TAG,
686
686
  "Final layout params - Margins: left=" +
687
- layoutParams.leftMargin +
688
- ", top=" +
689
- layoutParams.topMargin +
690
- ", Size: " +
691
- width +
692
- "x" +
693
- height
687
+ layoutParams.leftMargin +
688
+ ", top=" +
689
+ layoutParams.topMargin +
690
+ ", Size: " +
691
+ width +
692
+ "x" +
693
+ height
694
694
  );
695
695
  Log.d(TAG, "================================================================================");
696
696
 
@@ -725,20 +725,22 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
725
725
  Log.d(
726
726
  TAG,
727
727
  "Building camera selector with deviceId: " +
728
- sessionConfig.getDeviceId() +
729
- " and position: " +
730
- sessionConfig.getPosition()
728
+ sessionConfig.getDeviceId() +
729
+ " and position: " +
730
+ sessionConfig.getPosition()
731
731
  );
732
732
  currentCameraSelector = buildCameraSelector();
733
733
 
734
- ResolutionSelector.Builder resolutionSelectorBuilder = new ResolutionSelector.Builder()
735
- .setResolutionStrategy(ResolutionStrategy.HIGHEST_AVAILABLE_STRATEGY);
734
+ ResolutionSelector.Builder resolutionSelectorBuilder = new ResolutionSelector.Builder().setResolutionStrategy(
735
+ ResolutionStrategy.HIGHEST_AVAILABLE_STRATEGY
736
+ );
736
737
 
737
738
  if (sessionConfig.getAspectRatio() != null) {
738
739
  int aspectRatio;
739
740
  if ("16:9".equals(sessionConfig.getAspectRatio())) {
740
741
  aspectRatio = AspectRatio.RATIO_16_9;
741
- } else { // "4:3"
742
+ } else {
743
+ // "4:3"
742
744
  aspectRatio = AspectRatio.RATIO_4_3;
743
745
  }
744
746
  resolutionSelectorBuilder.setAspectRatioStrategy(
@@ -799,14 +801,14 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
799
801
  Log.d(
800
802
  TAG,
801
803
  "Active Zoom State: " +
802
- "min=" +
803
- zoomState.getMinZoomRatio() +
804
- ", " +
805
- "max=" +
806
- zoomState.getMaxZoomRatio() +
807
- ", " +
808
- "current=" +
809
- zoomState.getZoomRatio()
804
+ "min=" +
805
+ zoomState.getMinZoomRatio() +
806
+ ", " +
807
+ "max=" +
808
+ zoomState.getMaxZoomRatio() +
809
+ ", " +
810
+ "current=" +
811
+ zoomState.getZoomRatio()
810
812
  );
811
813
  }
812
814
 
@@ -831,12 +833,12 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
831
833
  Log.d(
832
834
  TAG,
833
835
  "Actual preview aspect ratio: " +
834
- actualRatio +
835
- " (width=" +
836
- currentPreviewResolution.getWidth() +
837
- ", height=" +
838
- currentPreviewResolution.getHeight() +
839
- ")"
836
+ actualRatio +
837
+ " (width=" +
838
+ currentPreviewResolution.getWidth() +
839
+ ", height=" +
840
+ currentPreviewResolution.getHeight() +
841
+ ")"
840
842
  );
841
843
 
842
844
  // Compare with requested ratio
@@ -882,12 +884,12 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
882
884
  if (listener != null) {
883
885
  listener.onCameraStartError(
884
886
  "Initial zoom level " +
885
- initialZoom +
886
- " is not available. " +
887
- "Valid range is " +
888
- minZoom +
889
- " to " +
890
- maxZoom
887
+ initialZoom +
888
+ " is not available. " +
889
+ "Valid range is " +
890
+ minZoom +
891
+ " to " +
892
+ maxZoom
891
893
  );
892
894
  return;
893
895
  }
@@ -912,13 +914,13 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
912
914
  Log.d(
913
915
  TAG,
914
916
  "onCameraStarted callback - actualX=" +
915
- actualX +
916
- ", actualY=" +
917
- actualY +
918
- ", actualWidth=" +
919
- actualWidth +
920
- ", actualHeight=" +
921
- actualHeight
917
+ actualX +
918
+ ", actualY=" +
919
+ actualY +
920
+ ", actualWidth=" +
921
+ actualWidth +
922
+ ", actualHeight=" +
923
+ actualHeight
922
924
  );
923
925
 
924
926
  // Update grid overlay bounds after camera is started
@@ -939,7 +941,7 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
939
941
  final String deviceId = sessionConfig.getDeviceId();
940
942
 
941
943
  if (deviceId != null && !deviceId.isEmpty()) {
942
- builder.addCameraFilter(cameraInfos -> {
944
+ builder.addCameraFilter((cameraInfos) -> {
943
945
  for (CameraInfo cameraInfo : cameraInfos) {
944
946
  if (deviceId.equals(Camera2CameraInfo.from(cameraInfo).getCameraId())) {
945
947
  return Collections.singletonList(cameraInfo);
@@ -994,17 +996,17 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
994
996
  Log.d(
995
997
  TAG,
996
998
  "capturePhoto: Starting photo capture with: " +
997
- quality +
998
- ", width: " +
999
- width +
1000
- ", height: " +
1001
- height +
1002
- ", saveToGallery: " +
1003
- saveToGallery +
1004
- ", embedTimestamp: " +
1005
- embedTimestamp +
1006
- ", embedLocation: " +
1007
- embedLocation
999
+ quality +
1000
+ ", width: " +
1001
+ width +
1002
+ ", height: " +
1003
+ height +
1004
+ ", saveToGallery: " +
1005
+ saveToGallery +
1006
+ ", embedTimestamp: " +
1007
+ embedTimestamp +
1008
+ ", embedLocation: " +
1009
+ embedLocation
1008
1010
  );
1009
1011
 
1010
1012
  boolean dispatched = false;
@@ -1440,8 +1442,11 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
1440
1442
  }
1441
1443
 
1442
1444
  java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream();
1443
- new org.apache.commons.imaging.formats.jpeg.exif.ExifRewriter()
1444
- .updateExifMetadataLossless(new java.io.ByteArrayInputStream(targetJpeg), out, outputSet);
1445
+ new org.apache.commons.imaging.formats.jpeg.exif.ExifRewriter().updateExifMetadataLossless(
1446
+ new java.io.ByteArrayInputStream(targetJpeg),
1447
+ out,
1448
+ outputSet
1449
+ );
1445
1450
  return out.toByteArray();
1446
1451
  } catch (Throwable t) {
1447
1452
  Log.w(TAG, "injectExifInMemory: Failed to write EXIF in memory", t);
@@ -2474,7 +2479,7 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
2474
2479
  // This filter will receive a list of all cameras and must return the one we want.
2475
2480
 
2476
2481
  currentCameraSelector = new CameraSelector.Builder()
2477
- .addCameraFilter(cameras -> {
2482
+ .addCameraFilter((cameras) -> {
2478
2483
  // This filter will receive a list of all cameras and must return the one we want.
2479
2484
  return Collections.singletonList(finalTarget);
2480
2485
  })
@@ -2893,32 +2898,32 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
2893
2898
  Log.d(
2894
2899
  TAG,
2895
2900
  "getActualCameraBounds FILL_CENTER: container=" +
2896
- containerWidth +
2897
- "x" +
2898
- containerHeight +
2899
- ", camera=" +
2900
- cameraWidth +
2901
- "x" +
2902
- cameraHeight +
2903
- " (portrait=" +
2904
- isPortrait +
2905
- ")" +
2906
- ", scale=" +
2907
- scale +
2908
- ", scaled=" +
2909
- scaledWidth +
2910
- "x" +
2911
- scaledHeight +
2912
- ", excess=" +
2913
- excessWidth +
2914
- "x" +
2915
- excessHeight +
2916
- ", adjusted=" +
2917
- adjustedWidth +
2918
- "x" +
2919
- adjustedHeight +
2920
- ", ratio=" +
2921
- aspectRatio
2901
+ containerWidth +
2902
+ "x" +
2903
+ containerHeight +
2904
+ ", camera=" +
2905
+ cameraWidth +
2906
+ "x" +
2907
+ cameraHeight +
2908
+ " (portrait=" +
2909
+ isPortrait +
2910
+ ")" +
2911
+ ", scale=" +
2912
+ scale +
2913
+ ", scaled=" +
2914
+ scaledWidth +
2915
+ "x" +
2916
+ scaledHeight +
2917
+ ", excess=" +
2918
+ excessWidth +
2919
+ "x" +
2920
+ excessHeight +
2921
+ ", adjusted=" +
2922
+ adjustedWidth +
2923
+ "x" +
2924
+ adjustedHeight +
2925
+ ", ratio=" +
2926
+ aspectRatio
2922
2927
  );
2923
2928
 
2924
2929
  // Return slightly inset bounds for 4:3 to avoid blue line
@@ -2945,27 +2950,27 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
2945
2950
  Log.d(
2946
2951
  TAG,
2947
2952
  "getActualCameraBounds FIT_CENTER: container=" +
2948
- containerWidth +
2949
- "x" +
2950
- containerHeight +
2951
- ", camera=" +
2952
- cameraWidth +
2953
- "x" +
2954
- cameraHeight +
2955
- " (swapped=" +
2956
- isPortrait +
2957
- ")" +
2958
- ", scale=" +
2959
- scale +
2960
- ", scaled=" +
2961
- scaledWidth +
2962
- "x" +
2963
- scaledHeight +
2964
- ", offset=(" +
2965
- offsetX +
2966
- "," +
2967
- offsetY +
2968
- ")"
2953
+ containerWidth +
2954
+ "x" +
2955
+ containerHeight +
2956
+ ", camera=" +
2957
+ cameraWidth +
2958
+ "x" +
2959
+ cameraHeight +
2960
+ " (swapped=" +
2961
+ isPortrait +
2962
+ ")" +
2963
+ ", scale=" +
2964
+ scale +
2965
+ ", scaled=" +
2966
+ scaledWidth +
2967
+ "x" +
2968
+ scaledHeight +
2969
+ ", offset=(" +
2970
+ offsetX +
2971
+ "," +
2972
+ offsetY +
2973
+ ")"
2969
2974
  );
2970
2975
 
2971
2976
  // Return the bounds relative to the container
@@ -3045,14 +3050,14 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
3045
3050
  Log.d(
3046
3051
  TAG,
3047
3052
  "setPreviewSize: Updated to " +
3048
- params.width +
3049
- "x" +
3050
- params.height +
3051
- " at (" +
3052
- params.leftMargin +
3053
- "," +
3054
- params.topMargin +
3055
- ")"
3053
+ params.width +
3054
+ "x" +
3055
+ params.height +
3056
+ " at (" +
3057
+ params.leftMargin +
3058
+ "," +
3059
+ params.topMargin +
3060
+ ")"
3056
3061
  );
3057
3062
 
3058
3063
  // Update session config to reflect actual layout
@@ -3077,14 +3082,14 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
3077
3082
  Log.d(
3078
3083
  TAG,
3079
3084
  "setPreviewSize: Calculated aspect ratio from " +
3080
- params.width +
3081
- "x" +
3082
- params.height +
3083
- " = " +
3084
- calculatedAspectRatio +
3085
- " (normalized ratio=" +
3086
- ratio +
3087
- ")"
3085
+ params.width +
3086
+ "x" +
3087
+ params.height +
3088
+ " = " +
3089
+ calculatedAspectRatio +
3090
+ " (normalized ratio=" +
3091
+ ratio +
3092
+ ")"
3088
3093
  );
3089
3094
  }
3090
3095
 
@@ -3113,10 +3118,10 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
3113
3118
  Log.d(
3114
3119
  TAG,
3115
3120
  "setPreviewSize: Aspect ratio changed from " +
3116
- currentAspectRatio +
3117
- " to " +
3118
- calculatedAspectRatio +
3119
- ", rebinding camera"
3121
+ currentAspectRatio +
3122
+ " to " +
3123
+ calculatedAspectRatio +
3124
+ ", rebinding camera"
3120
3125
  );
3121
3126
  bindCameraUseCases();
3122
3127
 
@@ -3282,12 +3287,12 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
3282
3287
  Log.d(
3283
3288
  TAG,
3284
3289
  "Display ratio check - Expected: " +
3285
- expectedDisplayRatio +
3286
- ", Actual: " +
3287
- displayedRatio +
3288
- ", Difference: " +
3289
- difference +
3290
- " (tolerance should be < 0.01)"
3290
+ expectedDisplayRatio +
3291
+ ", Actual: " +
3292
+ displayedRatio +
3293
+ ", Difference: " +
3294
+ difference +
3295
+ " (tolerance should be < 0.01)"
3291
3296
  );
3292
3297
  }
3293
3298
 
@@ -3309,13 +3314,13 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
3309
3314
  Log.d(
3310
3315
  TAG,
3311
3316
  "Post-layout verification - Actual position: " +
3312
- previewContainer.getLeft() +
3313
- "," +
3314
- previewContainer.getTop() +
3315
- ", Actual size: " +
3316
- previewContainer.getWidth() +
3317
- "x" +
3318
- previewContainer.getHeight()
3317
+ previewContainer.getLeft() +
3318
+ "," +
3319
+ previewContainer.getTop() +
3320
+ ", Actual size: " +
3321
+ previewContainer.getWidth() +
3322
+ "x" +
3323
+ previewContainer.getHeight()
3319
3324
  );
3320
3325
  updateGridOverlayBounds();
3321
3326
  });
@@ -3389,32 +3394,32 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
3389
3394
  Log.d(
3390
3395
  TAG,
3391
3396
  "getCurrentPreviewBounds DEBUG: " +
3392
- "actualBounds=(" +
3393
- actualX +
3394
- "," +
3395
- actualY +
3396
- "," +
3397
- actualWidth +
3398
- "x" +
3399
- actualHeight +
3400
- "), " +
3401
- "logicalBounds=(" +
3402
- x +
3403
- "," +
3404
- y +
3405
- "," +
3406
- width +
3407
- "x" +
3408
- height +
3409
- "), " +
3410
- "pixelRatio=" +
3411
- pixelRatio +
3412
- ", " +
3413
- "insets=(" +
3414
- webViewLeftInset +
3415
- "," +
3416
- webViewTopInset +
3417
- ")"
3397
+ "actualBounds=(" +
3398
+ actualX +
3399
+ "," +
3400
+ actualY +
3401
+ "," +
3402
+ actualWidth +
3403
+ "x" +
3404
+ actualHeight +
3405
+ "), " +
3406
+ "logicalBounds=(" +
3407
+ x +
3408
+ "," +
3409
+ y +
3410
+ "," +
3411
+ width +
3412
+ "x" +
3413
+ height +
3414
+ "), " +
3415
+ "pixelRatio=" +
3416
+ pixelRatio +
3417
+ ", " +
3418
+ "insets=(" +
3419
+ webViewLeftInset +
3420
+ "," +
3421
+ webViewTopInset +
3422
+ ")"
3418
3423
  );
3419
3424
 
3420
3425
  return new int[] { x, y, width, height };
@@ -3453,7 +3458,7 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
3453
3458
  FileOutputOptions outputOptions = new FileOutputOptions.Builder(currentVideoFile).build();
3454
3459
 
3455
3460
  // Create recording event listener
3456
- androidx.core.util.Consumer<VideoRecordEvent> videoRecordEventListener = videoRecordEvent -> {
3461
+ androidx.core.util.Consumer<VideoRecordEvent> videoRecordEventListener = (videoRecordEvent) -> {
3457
3462
  if (videoRecordEvent instanceof VideoRecordEvent.Start) {
3458
3463
  Log.d(TAG, "Video recording started");
3459
3464
  } else if (videoRecordEvent instanceof VideoRecordEvent.Finalize) {
@@ -49,11 +49,11 @@ public class GridOverlayView extends View {
49
49
  android.util.Log.d(
50
50
  "GridOverlayView",
51
51
  "setGridMode: Changed from '" +
52
- previousMode +
53
- "' to '" +
54
- this.gridMode +
55
- "', visibility: " +
56
- ("none".equals(this.gridMode) ? "GONE" : "VISIBLE")
52
+ previousMode +
53
+ "' to '" +
54
+ this.gridMode +
55
+ "', visibility: " +
56
+ ("none".equals(this.gridMode) ? "GONE" : "VISIBLE")
57
57
  );
58
58
  invalidate();
59
59
  }