BarcodeScanPreviewView

class BarcodeScanPreviewView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : FrameLayout, PreviewControllerInterface

This class is the custom view which include the preview/camera/analyzer for the barcode scanning. Please use it as UI component and operate with the right interface API.

Since

1.0.0

Constructors

Link copied to clipboard
@JvmOverloads
fun BarcodeScanPreviewView(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0)

Functions

Link copied to clipboard

Add filter if you want to exclude some barcodes so will not go to scan result. If you give many filters, the barcode should pass all filters, then will go to scan result.

Link copied to clipboard

Add overlay if you want to see barcode outline visually.

Link copied to clipboard
fun addControl(control: Control)

Use control if you need to control camera resource during runtime such as flashlight, zoom level, etc,.

Link copied to clipboard
fun addScanResultFeedback(scanResultFeedback: ScanResultFeedback)

Add this interface is to handle barcode result.

Link copied to clipboard
open override fun finishPreview()

this is to terminate the preview. usually call when the scan is done. The engine would also be stopped in this process. Need to call init before hand

Link copied to clipboard

Return current preview state.

Link copied to clipboard
open override fun init(config: PreviewConfig, resultHandlingCallback: PreviewResultHandlingCallback)

This is for the preview to get initial configuration data to know what to do If the config object is not set, the other interface API would not work

Link copied to clipboard
open override fun pausePreview()

This is to temporarily pause the preview frame on the UI. Need to call stopBarcodeAnalyzing to stop the barcode scanning analysis.

Link copied to clipboard
open override fun resumePreview()

This is to resume the preview after temporarily paused by pausePreview. Need to call startBarcodeAnalyzing to resume the barcode scanning analysis.

Link copied to clipboard
fun setViewFinder(viewFinder: ViewFinder?)

Set the viewfinder if you want to draw. default value is null

Link copied to clipboard
open override fun startBarcodeAnalyzing()

This is to start or resume the barcode engine to consume the frame for barcode detection Need to call init before hand Only work when getPreviewState == RESUME or PAUSE

Link copied to clipboard
open override fun startPreview()

This is to start camera preview to show frames, the engine would also be started automatically in this function Need to call init before hand

Link copied to clipboard
open override fun stopBarcodeAnalyzing()

this is to pause the barcode engine from consuming the camera frames. Need to call init before hand Only work when getPreviewState == RESUME or PAUSE