diff --git a/docs/api/camera.md b/docs/api/camera.md index b51b46c5..324bee99 100644 --- a/docs/api/camera.md +++ b/docs/api/camera.md @@ -24,31 +24,33 @@ view refresh. You can force a refresh by pausing and resuming the camera. :param AspectRatioMode mode: The mode to use for filling the camera preview. Can be one of the following values: - - `0`: `fillWithCrop`: The preview will be scaled to fit the picture, cropping the sides if - needed. The aspect ratio of the preview will be kept. - - `1`: `fillWithBlackBars`: The preview will be scaled to fit the picture, with black bars on - the sides if needed. The aspect ratio of the preview will be kept. - - `2`: `fillWithStretch`: The preview will fill the available space, by squashing or stretching - the preview if needed. The aspect ratio of the preview can be altered. - -.. image:: /pictures/crop.png -:width: 400 -:alt: fillWithCrop +- `0`: `fillWithCrop`: The preview will be scaled to fit the picture, cropping the sides if + needed. The aspect ratio of the preview will be kept. +- `1`: `fillWithBlackBars`: The preview will be scaled to fit the picture, with black bars on + the sides if needed. The aspect ratio of the preview will be kept. +- `2`: `fillWithStretch`: The preview will fill the available space, by squashing or stretching + the preview if needed. The aspect ratio of the preview can be altered. +::: -Example of a preview with the `fillWithCrop` mode. +Example of a preview with the `fillWithCrop` mode: -.. image:: /pictures/black_bars.png +:::{image} /pictures/crop.png :width: 400 -:alt: fillWithBlackBars +:alt: Example of a preview with the `fillWithCrop` mode. +::: -Example of a preview with the `fillWithBlackBars` mode. +Example of a preview with the `fillWithBlackBars` mode: -.. image:: /pictures/stretch.png +:::{image} /pictures/black_bars.png :width: 400 -:alt: fillWithStretch +:alt: Example of a preview with the `fillWithBlackBars` mode. +::: -Example of a preview with the `fillWithStretch` mode. +Example of a preview with the `fillWithStretch` mode: +:::{image} /pictures/stretch.png +:width: 400 +:alt: Example of a preview with the `fillWithStretch` mode. ::: :::{method} setReaderMode(CameraReader readerMode) -> void @@ -143,8 +145,8 @@ To use this view in your own layout, you can add the following block to its XML the attributes to your needs: ```xml - + app:useAdaptiveResolution="true" /> ``` The main XML attributes are as follow: @@ -194,12 +195,12 @@ The maximum vertical resolution of the camera preview, useful to limit performan :::{method} app:previewRatioMode The mode to use for filling the camera preview. Can be one of the following values: - - `0`: `fillWithCrop`: The preview will be scaled to fit the picture, cropping the sides if - needed. The aspect ratio of the preview will be kept. - - `1`: `fillWithBlackBars`: The preview will be scaled to fit the picture, with black bars on - the sides if needed. The aspect ratio of the preview will be kept. - - `2`: `fillWithStretch`: The preview will fill the available space, by squashing or stretching - the preview if needed. The aspect ratio of the preview can be altered. +- `0`: `fillWithCrop`: The preview will be scaled to fit the picture, cropping the sides if + needed. The aspect ratio of the preview will be kept. +- `1`: `fillWithBlackBars`: The preview will be scaled to fit the picture, with black bars on + the sides if needed. The aspect ratio of the preview will be kept. +- `2`: `fillWithStretch`: The preview will fill the available space, by squashing or stretching + the preview if needed. The aspect ratio of the preview can be altered. If the value of this attribute is not recognized or defined, the preview ratio mode will be set by default to `fillWithCrop`. @@ -263,17 +264,24 @@ The mode to use for filling the camera preview. Can be one of the following valu :returns: A map containing the IDs of the views used by the camera scanner. May be replaced with your own. -Contains the following keys: -- layout_id_camera: The ID of the layout containing the camera view. -- camera_view_id: The ID of the camera view in the layout. -- scanner_toggle_view_id: The ID of the view that toggles the scanner library reader. -- scanner_toggle_pause_id: The ID of the view that toggles the pause of the scanner. -- card_last_scan_id: ID of the card view that displays the last scan. -- constraint_layout_id: The ID of the constraint layout inside the camera layout. -- scanner_flashlight_id: The ID of the optional ImageButton on which to press to toggle the -flashlight/illumination. -- scanner_bt_provider_logs: The ID of the optional ImageButton on which to press to manually access -available providers logs +It contains the following values: +- `layout_id_camera`: The ID of the layout containing the camera view. + Set to `R.layout.activity_main_alt`. +- `camera_view_id`: The ID of the + [`CameraBarcodeScanView`](camera.md#the-camerabarcodescanview-class) inside the `layout_id_camera` + layout. Set to `R.id.cameraScanView`. +- `scanner_toggle_view_id`: The ID of the optional ImageButton on which to press to toggle the + zxing/zbar camera scan library. Set to `R.id.scannerSwitchZxing`. +- `scanner_toggle_pause_id`: The ID of the optional toggle button on which to press to pause/unpause + the scanner. Set to `R.id.scannerSwitchPause`. +- `card_last_scan_id`: The ID of the card view that displays the last scan. + Set to `R.id.cardCameraLastScan`. +- `constraint_layout_id`: The ID of the constraint layout inside the camera layout. + Set to `R.id.constraintLayoutMainActivity`. +- `scanner_flashlight_id`: The ID of the optional ImageButton on which to press to toggle the + flashlight/illumination. Set to `R.id.scannerFlashlight`. +- `scanner_bt_provider_logs`: The ID of the optional ImageButton on which to press to manually access + available providers logs. Set to `R.id.scannerBtProviderLogs`. ::: :::{method} getCameraScanner(Context ctx, ScannerConnectionHandler handler, ScannerSearchOptions options) -> void diff --git a/docs/api/scanner_activity.md b/docs/api/scanner_activity.md index ddc08af7..8e273937 100644 --- a/docs/api/scanner_activity.md +++ b/docs/api/scanner_activity.md @@ -58,24 +58,23 @@ The hashmap containing the IDs of the views used by the camera scanner. May be r own. If the camera SDK is included, it will be set to a map containing the following values: -- layout_id_camera: The ID of the layout containing the camera view -:::{cpp:var}R.layout.activity_main_alt:::. -- camera_view_id: The ID of the camera view in the layout :::{cpp:var}R.id.cameraScanView:::. - It is the ID of the [`CameraBarcodeScanView`](camera.md#the-camerabarcodescanview-class) inside the - `layout_id_camera` layout. - :::. -- scanner_toggle_view_id: It is the ID of the optional ImageButton on which to press to toggle the -zxing/zbar camera scan library :::{cpp:var}R.id.scannerSwitchZxing:::. -- scanner_toggle_pause_id: The ID of the optional toggle button on which to press to pause/unpause -the scanner :::{cpp:var}R.id.scannerSwitchPause:::. -- card_last_scan_id: ID of the card view that displays the last scan -:::{cpp:var}R.id.cardCameraLastScan:::. -- constraint_layout_id: The ID of the constraint layout inside the camera layout -:::{cpp:var}R.id.constraintLayoutMainActivity:::. -- scanner_flashlight_id: The ID of the optional ImageButton on which to press to toggle the -flashlight/illumination :::{cpp:var}R.id.scannerFlashlight:::. -- scanner_bt_provider_logs: The ID of the optional ImageButton on which to press to manually access -available providers logs :::{cpp:var}R.id.scannerBtProviderLogs:::. +- `layout_id_camera`: The ID of the layout containing the camera view. + Defaults to `R.layout.activity_main_alt`. +- `camera_view_id`: The ID of the + [`CameraBarcodeScanView`](camera.md#the-camerabarcodescanview-class) inside the `layout_id_camera` + layout. Defaults to `R.id.cameraScanView`. +- `scanner_toggle_view_id`: The ID of the optional ImageButton on which to press to toggle the + zxing/zbar camera scan library. Defaults to `R.id.scannerSwitchZxing`. +- `scanner_toggle_pause_id`: The ID of the optional toggle button on which to press to pause/unpause + the scanner. Defaults to `R.id.scannerSwitchPause`. +- `card_last_scan_id`: The ID of the card view that displays the last scan. + Defaults to `R.id.cardCameraLastScan`. +- `constraint_layout_id`: The ID of the constraint layout inside the camera layout. + Defaults to `R.id.constraintLayoutMainActivity`. +- `scanner_flashlight_id`: The ID of the optional ImageButton on which to press to toggle the + flashlight/illumination. Defaults to `R.id.scannerFlashlight`. +- `scanner_bt_provider_logs`: The ID of the optional ImageButton on which to press to manually access + available providers logs. Defaults to `R.id.scannerBtProviderLogs`. ::: :::{cpp:var} int cameraToggleId = R.id.scannerBtCamera diff --git a/docs/guides/custom_layout.md b/docs/guides/custom_layout.md index 3ffb8cdf..1c2cab39 100644 --- a/docs/guides/custom_layout.md +++ b/docs/guides/custom_layout.md @@ -29,19 +29,26 @@ To ensure activity is able to properly switch to the camera when needed, you sho following view block in the `.xml` file used by `layoutIdCamera`: ```xml - + app:useAdaptiveResolution="true" /> ``` Should you choose a different ID for this view, remember to also change the value of the diff --git a/enioka_scan_camera/src/main/java/com/enioka/scanner/sdk/camera/CameraProvider.java b/enioka_scan_camera/src/main/java/com/enioka/scanner/sdk/camera/CameraProvider.java index 66af33c9..10cb1f25 100644 --- a/enioka_scan_camera/src/main/java/com/enioka/scanner/sdk/camera/CameraProvider.java +++ b/enioka_scan_camera/src/main/java/com/enioka/scanner/sdk/camera/CameraProvider.java @@ -26,7 +26,7 @@ public HashMap getIdResources() { idResources.put("scanner_toggle_view_id", R.id.scannerSwitchZxing); idResources.put("scanner_toggle_pause_id", R.id.scannerSwitchPause); idResources.put("card_last_scan_id", R.id.cardCameraLastScan); - idResources.put("constraint_layout_id", R.id.constraint_layout_main_activity); + idResources.put("constraint_layout_id", R.id.constraintLayoutMainActivity); idResources.put("scanner_flashlight_id", R.id.scannerFlashlight); idResources.put("scanner_bt_provider_logs", R.id.scannerBtProviderLogs); diff --git a/enioka_scan_camera/src/main/res/layout/activity_camera.xml b/enioka_scan_camera/src/main/res/layout/activity_camera.xml index 2193fb4b..17fb921f 100644 --- a/enioka_scan_camera/src/main/res/layout/activity_camera.xml +++ b/enioka_scan_camera/src/main/res/layout/activity_camera.xml @@ -2,7 +2,7 @@