ScanOverlay Class Referenceabstract

Inherits RelativeLayout.

Public Member Functions

abstract void setGuiStyle (int guiStyle)
 
Sound Configuration

Customize the scan sound.

abstract void setBeepEnabled (boolean enabled)
 
abstract void setVibrateEnabled (boolean enabled)
 
Torch Configuration

Enable and customize appearance of the torch icon.

abstract void setTorchEnabled (boolean enabled)
 
abstract void setTorchOnImage (Bitmap image)
 
abstract void setTorchOnImage (Bitmap image, Bitmap pressedImage)
 
abstract void setTorchOffImage (Bitmap image)
 
abstract void setTorchOffImage (Bitmap image, Bitmap pressedImage)
 
abstract void setTorchButtonMarginsAndSize (int leftMargin, int topMargin, int width, int height)
 
abstract void setTorchOffContentDescription (String contentDescription)
 
abstract void setTorchOnContentDescription (String contentDescription)
 
Camera Switch Configuration

Enable camera switch and set icons

abstract void setCameraSwitchVisibility (int visibility)
 
abstract void setCameraSwitchImage (Bitmap image, Bitmap pressedImage)
 
abstract void setCameraSwitchButtonMarginsAndSize (int rightMargin, int topMargin, int width, int height)
 
abstract void setCameraSwitchBackContentDescription (String contentDescription)
 
abstract void setCameraSwitchFrontContentDescription (String contentDescription)
 
Text Recognition Switch Configuration

Customize the viewfinder where the barcode location is highlighted.

abstract void setTextRecognitionSwitchVisible (boolean visible)
 
Viewfinder Configuration

Customize the viewfinder where the barcode location is highlighted.

abstract void drawViewfinder (boolean draw)
 
abstract void setViewfinderDimension (float width, float height, float landscapeWidth, float landscapeHeight)
 
abstract void setViewfinderPortraitDimension (float width, float height)
 
abstract void setViewfinderLandscapeDimension (float width, float height)
 
abstract void setViewfinderColor (float r, float g, float b)
 
abstract void setViewfinderDecodedColor (float r, float g, float b)
 
abstract void setMissingCameraPermissionInfoText (String text)
 
abstract void setMatrixScanHighlightingColor (int state, int color)
 
Non-Official Methods
abstract void setProperty (String key, Object value)
 

Static Public Attributes

Camera Switch Button Visibility
static final int CAMERA_SWITCH_NEVER
 
static final int CAMERA_SWITCH_ON_TABLET
 
static final int CAMERA_SWITCH_ALWAYS
 
Scan UI style
static final int GUI_STYLE_DEFAULT
 
static final int GUI_STYLE_LASER
 
static final int GUI_STYLE_NONE
 
static final int GUI_STYLE_MATRIX_SCAN
 
static final int GUI_STYLE_LOCATIONS_ONLY
 
Highlighting states of tracked barcodes (MatrixScan)
static final int MATRIX_SCAN_HIGHLIGHTING_STATE_LOCALIZED
 
static final int MATRIX_SCAN_HIGHLIGHTING_STATE_RECOGNIZED
 
static final int MATRIX_SCAN_HIGHLIGHTING_STATE_REJECTED
 

Detailed Description

Abstract scan UI class.

The ScanOverlay implements the scan UI displayed on top of the video feed. It is responsible for highlighting barcodes and draw the viewfinder rectangle or laser UI.

Member Function Documentation

abstract void setGuiStyle ( int  guiStyle)
abstract

The GUI style drawn to display the indicator where the code should be scanned and the visualization of recognized codes.

Parameters
guiStyleMust be one of GUI_STYLE_DEFAULT, GUI_STYLE_LASER or GUI_STYLE_NONE. By default this is GUI_STYLE_DEFAULT.
Since
4.9.0
abstract void setBeepEnabled ( boolean  enabled)
abstract

Enables (or disables) the sound when a barcode is recognized.

If the phone's ring mode is set to muted or vibrate, no beep will be played regardless of the value.

Enabled by default.

Since
4.9.0
Parameters
enabledWhether the beep is enabled.
abstract void setVibrateEnabled ( boolean  enabled)
abstract

Enables or disables the vibration when a code was recognized.

If the phone's ring mode is set to muted, no beep will be played regardless of the value.

Enabled by default.

Since
4.9.0
Parameters
enabledWhether vibrate is enabled.
abstract void setTorchEnabled ( boolean  enabled)
abstract

Enables or disables the torch toggle button for all devices/cameras that support a torch.

By default it is enabled. The torch icon is never shown when the camera does not have a torch (most tablets, front cameras, etc).

Since
4.9.0
Parameters
enabledWhether the torch button should be shown.
abstract void setTorchOnImage ( Bitmap  image)
abstract

Sets the image which is being drawn when the torch is on.

If you want this to be displayed in proper resolution on high resolution screens, you need to provide a resource big enough to work with at least xhdpi resolution.

Since
4.9.0
Parameters
imageThe new image for when the torch is on.
abstract void setTorchOnImage ( Bitmap  image,
Bitmap  pressedImage 
)
abstract

Sets the images which are being drawn when the torch is on.

If you want this to be displayed in proper resolution on high resolution screens, you need to provide a resource big enough to work with at least xhdpi resolution.

Since
4.9.0
Parameters
imageThe new image for when the torch is on.
pressedImageThe new image for when the torch is on and it is pressed.
abstract void setTorchOffImage ( Bitmap  image)
abstract

Sets the image which is being drawn when the torch is off.

If you want this to be displayed in proper resolution on high resolution screens, you need to provide a resource big enough to work with at least xhdpi resolution.

Since
4.9.0
Parameters
imageThe new image for when the torch is off.
abstract void setTorchOffImage ( Bitmap  image,
Bitmap  pressedImage 
)
abstract

Sets the images which are being drawn when the torch is off.

If you want this to be displayed in proper resolution on high resolution screens, you need to provide a resource big enough to work with at least xhdpi resolution.

Since
4.9.0
Parameters
imageThe new image for when the torch is off.
pressedImageThe new image for when the torch is off and it is pressed.
abstract void setTorchButtonMarginsAndSize ( int  leftMargin,
int  topMargin,
int  width,
int  height 
)
abstract

Sets the position at which the button to enable the torch is drawn.

By default the margins are 15 and width and height are 40.

Since
4.7.0
Parameters
leftMarginLeft margin in points.
topMarginTop margin in points.
widthWidth in points.
heightHeight in points.
abstract void setTorchOffContentDescription ( String  contentDescription)
abstract

Sets the content description for the torch button while the torch is off.

The content description gives vision-impaired users voice over guidance for the torch button while the torch is turned off. The default label is "Torch Switch (Currently Off)".

Since
4.9.0
Parameters
contentDescriptionThe content description.
abstract void setTorchOnContentDescription ( String  contentDescription)
abstract

Sets the content description for the torch button while the torch is on.

The content description gives vision-impaired users voice over guidance for the torch button while the torch is turned on. The default label is "Torch Switch (Currently On)".

Since
4.9.0
Parameters
contentDescriptionThe content description.
abstract void setCameraSwitchVisibility ( int  visibility)
abstract

Sets when the camera switch button is visible for devices that have more than one camera.

By default it is CAMERA_SWITCH_NEVER.

Since
4.9.0
Parameters
visibilityThe visibility of the camera switch button (.CAMERA_SWITCH_NEVER, CAMERA_SWITCH_ON_TABLET, CAMERA_SWITCH_ALWAYS)
abstract void setCameraSwitchImage ( Bitmap  image,
Bitmap  pressedImage 
)
abstract

Sets the images which are being drawn when the camera switch button is visible.

If you want this to be displayed in proper resolution on high resolution screens, you need to also provide a resource with the same name but @2x appended and in higher resolution (like flash.nosp@m.ligh.nosp@m.t-tur.nosp@m.n-on.nosp@m.-icon.nosp@m.@2x..nosp@m.png).

File needs to be placed in Resources folder.

By default this is: "camera-swap-icon.png" and "camera-swap-icon-pressed.png"

Since
4.9.0
Parameters
imageThe new image for the camera swap button.
pressedImageThe new image for the camera swap button when it is pressed.
abstract void setCameraSwitchButtonMarginsAndSize ( int  rightMargin,
int  topMargin,
int  width,
int  height 
)
abstract

Sets the position at which the button to switch the camera is drawn.

By default the margins are 15 and width and height are 40.

Since
3.0.0
Parameters
rightMarginRight margin in dp.
topMarginTop margin in dp.
widthWidth in dp.
heightHeight in dp.
abstract void setCameraSwitchBackContentDescription ( String  contentDescription)
abstract

Sets the content description for the camera switch button while the back-facing camera is active.

The content description gives vision-impaired users voice over guidance for the camera switch button while the back-facing camera is active. The default description is "Camera Switch (Currently back-facing)".

Since
4.9.0
Parameters
contentDescriptionThe content description.
abstract void setCameraSwitchFrontContentDescription ( String  contentDescription)
abstract

Sets the content description for the camera switch button while the front-facing camera is active.

The content description gives vision-impaired users voice over guidance for the camera switch button while the front-facing camera is active. The default description is "Camera Switch (Currently front-facing)".

Since
4.9.0
Parameters
contentDescriptionThe content description.
abstract void setTextRecognitionSwitchVisible ( boolean  visible)
abstract

Sets whether the button to switch between different recognition modes should be visible.

If The scanner only supports one recognition mode the button is never shown.

Parameters
visibleWhether the button should be visible.
Since
5.2.0
abstract void drawViewfinder ( boolean  draw)
abstract

Note: This feature is only available with the Scandit SDK Enterprise Packages.

By default this is enabled.

Since
4.9.0
Parameters
drawWhether the viewfinder rectangle should be drawn.
abstract void setViewfinderDimension ( float  width,
float  height,
float  landscapeWidth,
float  landscapeHeight 
)
abstract

Sets the size of the viewfinder relative to the size of the screen size.

Changing this value does not(!) affect the area in which barcodes are successfully recognized. It only changes the size of the box drawn onto the scan screen. To restrict the active scanning area, use the methods listed below.

See also
ScanSettings.enableRestrictedAreaScanning(boolean)
ScanSettings.setScanningHotSpot(float, float)
ScanSettings.setScanningHotSpotHeight(float)

By default the width is 0.9, height is 0.4, landscapeWidth is 0.6, landscapeHeight is 0.4

Since
4.9.0
Parameters
widthWidth of the viewfinder rectangle in portrait orientation.
heightHeight of the viewfinder rectangle in portrait orientation.
landscapeWidthWidth of the viewfinder rectangle in landscape orientation.
landscapeHeightHeight of the viewfinder rectangle in landscape orientation.
abstract void setViewfinderPortraitDimension ( float  width,
float  height 
)
abstract

Sets the size of the viewfinder relative to the size of the screen size in portrait orientation.

Changing this value does not(!) affect the area in which barcodes are successfully recognized. It only changes the size of the box drawn onto the scan screen. To restrict the active scanning area, use the methods listed below.

See also
ScanSettings.enableRestrictedAreaScanning(boolean)
ScanSettings.setScanningHotSpot(float, float)
ScanSettings.setScanningHotSpotHeight(float)

By default the width is 0.8, height is 0.4

Since
4.16.0
Parameters
widthWidth of the viewfinder rectangle in portrait orientation.
heightHeight of the viewfinder rectangle in portrait orientation.
abstract void setViewfinderLandscapeDimension ( float  width,
float  height 
)
abstract

Sets the size of the viewfinder relative to the size of the screen size in landscape orientation.

Changing this value does not(!) affect the area in which barcodes are successfully recognized. It only changes the size of the box drawn onto the scan screen. To restrict the active scanning area, use the methods listed below.

See also
ScanSettings.enableRestrictedAreaScanning(boolean)
ScanSettings.setScanningHotSpot(float, float)
ScanSettings.setScanningHotSpotHeight(float)

By default the width is 0.6, height is 0.4

Since
4.16.0
Parameters
widthWidth of the viewfinder rectangle in landscape orientation.
heightHeight of the viewfinder rectangle in landscape orientation.
abstract void setViewfinderColor ( float  r,
float  g,
float  b 
)
abstract

Sets the color of the viewfinder before a bar code has been recognized.

Note: This feature is only available with the Scandit SDK Enterprise Packages.

By default this is: white (1.0, 1.0, 1.0)

Since
4.9.0
Parameters
rRed component (between 0.0 and 1.0).
gGreen component (between 0.0 and 1.0).
bBlue component (between 0.0 and 1.0).
abstract void setViewfinderDecodedColor ( float  r,
float  g,
float  b 
)
abstract

Sets the color of the viewfinder once the bar code has been recognized.

Note: This feature is only available with the Scandit SDK Enterprise Packages.

By default this is: light blue (0.222, 0.753, 0.8)

Since
4.9.0
Parameters
rRed component (between 0.0 and 1.0).
gGreen component (between 0.0 and 1.0).
bBlue component (between 0.0 and 1.0).
abstract void setMissingCameraPermissionInfoText ( String  text)
abstract

Sets the text shown if the camera can not be aquired because the app does not have permission to access the camera.

By default this is: "The Barcode Picker was unable to access the device's camera. \n\nGo to the App's Settings check that it has permission to use the camera."

Since
5.4.0
Parameters
textThe text shown if the camera can not be aquired.
abstract void setMatrixScanHighlightingColor ( int  state,
int  color 
)
abstract

Sets the color of the highlighting in the specified tracking state (MatrixScan).

Since
5.2.0
Parameters
stateA highlighting state. Must be one of MATRIX_SCAN_HIGHLIGHTING_STATE_LOCALIZED, MATRIX_SCAN_HIGHLIGHTING_STATE_RECOGNIZED, MATRIX_SCAN_HIGHLIGHTING_STATE_REJECTED.
colorA color.
abstract void setProperty ( String  key,
Object  value 
)
abstract

Set custom property.

This function is for internal use/and or experimental features and any functionality that can be accessed through it can and will vanish without public notice from one version to the next. Do not use this method unless you specifically have to.

Parameters
keyThe name of the property
valuethe value for the property.

Member Data Documentation

final int CAMERA_SWITCH_NEVER
static

The camera switch button is always hidden.

final int CAMERA_SWITCH_ON_TABLET
static

The camera switch button is shown on tablet devices with front and back cameras.

final int CAMERA_SWITCH_ALWAYS
static

The camera switch button is shown on all devices that have front and back cameras.

final int GUI_STYLE_DEFAULT
static

A rectangular viewfinder with rounded corners is shown in the specified size.

Recognized codes are marked with four corners.

final int GUI_STYLE_LASER
static

A laser line is shown with the specified width while the height is not changeable.

This mode should generally not be used if the recognition is running on the whole screen as it indicates that the code should be placed at the location of the laser line.

final int GUI_STYLE_NONE
static

No UI is shown to indicate where the barcode should be placed.

Be aware that the Scandit logo continues to be displayed as showing it is part of the license agreement.

final int GUI_STYLE_MATRIX_SCAN
static

The MatrixScan UI is shown.

In order to use this UI, it is required to set ScanSettings::setMatrixScanEnabled(boolean) to true. Only available on Android version 11 and up.

See also
ScanSettings::setMatrixScanEnabled(boolean)
setMatrixScanHighlightingColor(int, int)
final int GUI_STYLE_LOCATIONS_ONLY
static

Like GUI_STYLE_NONE, but barcode locations are highlighted in the UI.

final int MATRIX_SCAN_HIGHLIGHTING_STATE_LOCALIZED
static

State for tracked barcodes that have been localized, but not recognized yet.

Since
5.2.0
final int MATRIX_SCAN_HIGHLIGHTING_STATE_RECOGNIZED
static

State for tracked barcodes that have been recognized.

Since
5.2.0
final int MATRIX_SCAN_HIGHLIGHTING_STATE_REJECTED
static

State for tracked barcodes that have been rejected with ScanSession.rejectTrackedCode.

Since
5.2.0

The documentation for this class was generated from the following file:
  • ScanOverlay.java