IBcmBranding
The SDK brading configuration interface (IBcmBranding) is an optional interface.
The interface is for an object to be assigned to IBcmGlobalConfig's branding property.
It allows you to configure branding of the SDK.
Please refer to the Branding page for a high-level overview.
Interface
Kotlin:
/**
* Branding configuration interface; can be overwritten
* @author Manuel Schmitzberger <ms@ms-sw.at>
*/
open class IBcmBranding {
companion object {
/**
* Adjust alpha value for given color.
*/
fun adjustAlpha(
color: Int,
factor: Float
): Int {
val alpha = (Color.alpha(color) * factor).roundToInt()
val red = Color.red(color)
val green = Color.green(color)
val blue = Color.blue(color)
return Color.argb(alpha, red, green, blue)
}
/**
* Adjust brightness for given color.
*/
fun adjustBrightness(
color: Int,
factor: Float
): Int {
val hsv = FloatArray(3)
Color.colorToHSV(color, hsv)
hsv[2] = factor
return Color.HSVToColor(hsv)
}
}
/***********************************************************************************************
* Custom colors.
*/
/**
* Tint color for control bars, navigation bars, and buttons.
*/
open fun universalPrimary(
context: Context
): Int = adjustBrightness(Color.parseColor("#00a8d0"), 0.32f)
/**
* Tint color for control bars, navigation bars, and buttons.
*/
open fun universalPrimaryDark(
context: Context
): Int = adjustBrightness(Color.parseColor("#00a8d0"), 0.32f)
/**
* Finger live preview. Initial bounding box color.
*/
open fun fingerLiveBoundingBoxInitial(
context: Context
): Int = Color.WHITE
/**
* Finger live preview. Bounding box color when the configured score threshold is reached.
*/
open fun fingerLiveBoundingBoxScoreReached(
context: Context
): Int = Color.GREEN
/**
* Finger live preview. Bounding box color for fingers which are not selected.
*/
open fun fingerLiveUnselected(
context: Context
): Int = adjustAlpha(Color.GRAY, 0.32f)
/**
* Finger selection view. Start button color.
*/
open fun fingerSelectedStartButton(
context: Context
) = Color.parseColor("#00a8d0")
/**
* Finger selection view. Finger is excluded color.
*/
open fun fingerExcluded(
context: Context
) = Color.RED
/**
* Finger selection view. Finger is selected color.
*/
open fun fingerSelected(
context: Context
) = Color.parseColor("#00a8d0")
/**
* Finger selection view. Finger is unselected color.
*/
open fun fingerUnselected(
context: Context
) = Color.GRAY
/***********************************************************************************************
* Custom images.
*/
/**
* Image, which is always displayed at the top right of the scan screen.
*/
open fun scanLogo(
context: Context
): Int = R.drawable.bcm_scan_logo
/***********************************************************************************************
* Custom text.
*/
/**
* Custom texts finger selection dialog.
*/
open fun txtFingerSelectionPortraitRBtnRight(): String = "right"
open fun txtFingerSelectionPortraitRBtnLeft(): String = "left"
open fun txtFingerSelectionPortraitBtnAll(): String = "all"
open fun txtFingerSelectionLandscapeBtnRightAll(): String = "right all"
open fun txtFingerSelectionLandscapeBtnLeftAll(): String = "left all"
open fun txtFingerSelectionTitle(): String = "Tap on fingertip to select"
open fun txtFingerSelectionStart(): String = "start"
/**
* Custom texts scan screen.
*/
open fun txtScanFragmentStatusLeftHand(): String = "Now please put your LEFT HAND in front of the camera.\nYou can move your fingers in order to get the green boxes."
open fun txtScanFragmentStatusRightHand(): String = "Now please put your RIGHT HAND in front of the camera.\nYou can move your fingers in order to get the green boxes."
open fun txtScanFragmentStatusThumbs(): String = "Now please put your BOTH THUMBS in front of the camera.\nYou can move your fingers in order to get the green boxes."
open fun txtScanFragmentBtnFinish(): String = "finish"
open fun txtSwitchFingersTitle(): String = "Switch to next Fingers"
open fun txtSwitchFingersBtnOk(): String = "OK"
open fun txtIdCalibrationTitle(): String = "ID calibration info"
open fun txtScanIdCalibrationInfo(): String = "1. Hold the card in your hand under the phone \n 2. Make sure that the card fits into the template and is parallel to the phone \n 3. Press start \n 4. Keep the card still please do not move the phone or the card \n 5. Wait for a few seconds till the phone is calibrated"
/**
* Custom hand images on scan screen.
*/
open fun imageScanFragmentHandTemplate(
context: Context
): Int = R.drawable.bcm_right_hand_template
open fun imageScanFragmentBothThumbsTemplate(
context: Context
): Int = R.drawable.bcm_both_thumbs_template
open fun imageScanFragmentLeftThumbsTemplate(
context: Context
): Int = R.drawable.bcm_left_thumb_template
open fun imageScanFragmentLeftRightTemplate(
context: Context
): Int = R.drawable.bcm_right_thumb_template
open fun imageScanFragmentStatusLeftHand(
context: Context
): Int = R.drawable.bcm_left_hand
open fun imageScanFragmentStatusRightHand(
context: Context
): Int = R.drawable.bcm_right_hand
open fun imageScanFragmentStatusThumbs(
context: Context
): Int = R.drawable.bcm_both_thumbs_template
open fun imageScanFragmentStatusLeftThumb(
context: Context
): Int = R.drawable.bcm_left_thumb_status
open fun imageScanFragmentStatusRightThumb(
context: Context
): Int = R.drawable.bcm_right_thumb_status
}
Example
Kotlin:
class BcmBranding() : IBcmBranding() {
override fun universalPrimary(
context: Context
): Int = Color.parseColor("#00a8d0")
open fun scanLogo(
context: Context
): Int = R.drawable.bcm_scan_logo
...
}
Java:
public class BcmBranding extends IBcmBranding {
public BcmBranding() {
super();
}
@Override
public int universalPrimary(
Context context
) {
return Color.parseColor("#00a8d0");
}
@Override
public int scanLogo(
Context context
) {
return R.drawable.bcm_scan_logo;
}
...
}
Initialize the branding config in the IBcmGlobalConfig class
Kotlin:
class BcmGlobalConfig() : IBcmGlobalConfig() {
override fun branding(): IBcmBranding = BcmBranding()
}
Java:
public class BcmGlobalConfig extends IBcmGlobalConfig {
public BcmGlobalConfig() {
super();
}
@Override
public IBcmBranding branding() {
return new BcmBranding();
}
}