Barcode Tracking Advanced Overlay#

Defined in package com.scandit.datacapture.barcode.tracking.ui.overlay

BarcodeTrackingAdvancedOverlay#
class BarcodeTrackingAdvancedOverlay : FrameLayout, DataCaptureOverlay

Added in version 6.0.0

An overlay for DataCaptureView that allows anchoring a single user-provided View to each tracked barcode.

The provided view is visible on the top of the camera preview as long as its tracked barcode is and for all this time retains its relative position to it. This is useful when an additional information should be provided to tracked barcodes in real time. For instance, a user may overlay the price of an item or its expiry date for each corresponding barcode.

To display the views, this overlay must be attached to a DataCaptureView. This may be done either by creating it with newInstance() with a non-null view parameter or by passing this overlay to DataCaptureView.addOverlay().

A user of this class may configure what view is displayed for the given barcode and the relative position between the two by implementing BarcodeTrackingAdvancedOverlayListener or by calling setViewForTrackedBarcode(), setAnchorForTrackedBarcode() or setOffsetForTrackedBarcode().

For additional information about using this overlay, refer to Get Started With MatrixScan and Add AR Overlays in MatrixScan.

newInstance(barcodeTracking, view)#
static @NonNull BarcodeTrackingAdvancedOverlay newInstance(
        @NonNull BarcodeTracking barcodeTracking,
        @Nullable DataCaptureView view)

Added in version 6.0.0

Constructs a new barcode tracking advanced overlay for the barcode tracking instance. The overlay is automatically added to the view.

fromJson(mode, jsonData)#
static @NonNull BarcodeTrackingAdvancedOverlay fromJson(
        @NonNull BarcodeTracking mode,
        @NonNull String jsonData)

Added in version 6.3.0

Constructs a new barcode tracking advanced overlay with the provided JSON serialization. See Serialization for details.

For the overlay to be displayed on screen, it must be added to a DataCaptureView.

listener#
@Nullable BarcodeTrackingAdvancedOverlayListener getListener()
void setListener(@Nullable BarcodeTrackingAdvancedOverlayListener value)

Added in version 6.0.0

setViewForTrackedBarcode(trackedBarcode, view)#
void setViewForTrackedBarcode(@NonNull TrackedBarcode trackedBarcode,
        @Nullable View view)

Added in version 6.0.0

The method can be called to change the view drawn for the given tracked barcode. Setting the view to null will unset the view from the tracked barcode and will effectively remove it from the overlay. This method is thread-safe, it can be called from any thread. The view set via this method will take precedence over the one set via BarcodeTrackingAdvancedOverlayListener.viewForTrackedBarcode(): in case a view is set before BarcodeTrackingAdvancedOverlayListener.viewForTrackedBarcode() got called, no call to BarcodeTrackingAdvancedOverlayListener.viewForTrackedBarcode() will happen.

setAnchorForTrackedBarcode(trackedBarcode, anchor)#
void setAnchorForTrackedBarcode(@NonNull TrackedBarcode trackedBarcode,
        Anchor anchor)

Added in version 6.0.0

The method can be called to change the anchor point for the view associated with the given tracked barcode. This method is thread-safe, it can be called from any thread. The anchor set via this method will take precedence over the one set via BarcodeTrackingAdvancedOverlayListener.anchorForTrackedBarcode(): in case a view is set before BarcodeTrackingAdvancedOverlayListener.anchorForTrackedBarcode() got called, no call to BarcodeTrackingAdvancedOverlayListener.anchorForTrackedBarcode() will happen.

setOffsetForTrackedBarcode(trackedBarcode, offset)#
void setOffsetForTrackedBarcode(@NonNull TrackedBarcode trackedBarcode,
        @NonNull PointWithUnit offset)

Added in version 6.0.0

The method can be called to change the offset for the view associated with the given tracked barcode. This method is thread-safe, it can be called from any thread. The offset set via this method will take precedence over the one set via BarcodeTrackingAdvancedOverlayListener.offsetForTrackedBarcode(): in case a view is set before BarcodeTrackingAdvancedOverlayListener.offsetForTrackedBarcode() got called, no call to BarcodeTrackingAdvancedOverlayListener.offsetForTrackedBarcode() will happen. If the MeasureUnit of the offset is MeasureUnit.FRACTION, the offset is calculated relative to view’s dimensions.

clearTrackedBarcodeViews()#
void clearTrackedBarcodeViews()

Added in version 6.0.0

Clears all the views for the currently tracked barcodes from this overlay. This method is thread-safe, it can be called from any thread.

updateFromJson(jsonData)#
void updateFromJson(@NonNull String jsonData)

Added in version 6.3.0

Updates the overlay according to a JSON serialization. See Serialization for details.