ScanOverlay Interface Reference

Public Member Functions

void SetGuiStyle (int guiStyle)
 
Sound Configuration

Customize the scan sound.

void SetBeepEnabled (boolean enabled)
 
void SetVibrateEnabled (boolean enabled)
 
Torch Configuration

Enable and customize appearance of the torch icon.

void SetTorchEnabled (boolean enabled)
 
void SetTorchOnImage (Bitmap image)
 
void SetTorchOnImage (Bitmap image, Bitmap pressedImage)
 
void SetTorchOffImage (Bitmap image)
 
void SetTorchOffImage (Bitmap image, Bitmap pressedImage)
 
void SetTorchButtonMarginsAndSize (int leftMargin, int topMargin, int width, int height)
 
void SetTorchOffContentDescription (String contentDescription)
 
void SetTorchOnContentDescription (String contentDescription)
 
Camera Switch Configuration

Enable camera switch and set icons

void SetCameraSwitchVisibility (int visibility)
 
void SetCameraSwitchImage (Bitmap image, Bitmap pressedImage)
 
void SetCameraSwitchButtonMarginsAndSize (int rightMargin, int topMargin, int width, int height)
 
void SetCameraSwitchBackContentDescription (String contentDescription)
 
void SetCameraSwitchFrontContentDescription (String contentDescription)
 
Viewfinder Configuration

Customize the viewfinder where the barcode location is highlighted.

void SetViewfinderDimension (float width, float height, float landscapeWidth, float landscapeHeight)
 
void SetViewfinderColor (float r, float g, float b)
 
void SetViewfinderDecodedColor (float r, float g, float b)
 
Non-Official Methods
void SetProperty (String key, Object value)
 

Static Public Attributes

Camera Switch Button Visibility
static final int CameraSwitchNever
 
static final int CameraSwitchOnTablet
 
static final int CameraSwitchAlways
 
Scan UI style
static final int GuiStyleDefault
 
static final int GuiStyleLaser
 
static final int GuiStyleNone
 

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

void SetGuiStyle ( int  guiStyle)

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 GuiStyleDefault or GuiStyleDefault. By default this is GuiStyleDefault.
Since
4.9.0
void SetBeepEnabled ( boolean  enabled)

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.
void SetVibrateEnabled ( boolean  enabled)

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.
void SetTorchEnabled ( boolean  enabled)

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.
void SetTorchOnImage ( Bitmap  image)

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.
void SetTorchOnImage ( Bitmap  image,
Bitmap  pressedImage 
)

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.
void SetTorchOffImage ( Bitmap  image)

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.
void SetTorchOffImage ( Bitmap  image,
Bitmap  pressedImage 
)

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.
void SetTorchButtonMarginsAndSize ( int  leftMargin,
int  topMargin,
int  width,
int  height 
)

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.
void SetTorchOffContentDescription ( String  contentDescription)

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.
void SetTorchOnContentDescription ( String  contentDescription)

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.
void SetCameraSwitchVisibility ( int  visibility)

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

By default it is CameraSwitchNever.

Since
4.9.0
Parameters
visibilityThe visibility of the camera switch button (CameraSwitchNever, CameraSwitchOnTablet, CameraSwitchAlways)
void SetCameraSwitchImage ( Bitmap  image,
Bitmap  pressedImage 
)

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.
void SetCameraSwitchButtonMarginsAndSize ( int  rightMargin,
int  topMargin,
int  width,
int  height 
)

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.
void SetCameraSwitchBackContentDescription ( String  contentDescription)

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.
void SetCameraSwitchFrontContentDescription ( String  contentDescription)

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.
void SetViewfinderDimension ( float  width,
float  height,
float  landscapeWidth,
float  landscapeHeight 
)

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.8, 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.
void SetViewfinderColor ( float  r,
float  g,
float  b 
)

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).
void SetViewfinderDecodedColor ( float  r,
float  g,
float  b 
)

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).
void SetProperty ( String  key,
Object  value 
)

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 CameraSwitchNever
static

The camera switch button is always hidden.

final int CameraSwitchOnTablet
static

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

final int CameraSwitchAlways
static

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

final int GuiStyleDefault
static

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

Recognized codes are marked with four corners.

final int GuiStyleLaser
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 GuiStyleNone
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.