BcmBranding
The SDK brading configuration interface (BcmBranding) is an optional interface. The interface is
for an object to be assigned to BcmGlobalConfig'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:
open class BcmBranding {
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.
*/
/**
* GIF, which is shown in the intro screen if enabled.
* BcmScanConfig.isIntroScreenOn();
*/
open fun scanIntroGif(
context: Context
): Int? = null
/**
* Image, which is always displayed at the top right of the scan screen.
*/
open fun scanLogo(
context: Context
): Int? = R.drawable.bcm_scan_logo
/**
* GIF, which is shown in the intro screen if enabled.
*/
open fun calibrationIntroGif(
context: Context
): Int? = null
/***********************************************************************************************
* 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 txtScanFragmentStatusLeftThumb(): String = "Now please put your LEFT THUMB in front of the camera.\nYou can move your fingers in order to get the green boxes."
open fun txtScanFragmentStatusRightThumb(): String = "Now please put your RIGHT THUMB in front of the camera.\nYou can move your fingers in order to get the green boxes."
open fun txtScanFragmentBtnNext(): String = "next"
open fun txtScanFragmentBtnFinish(): String = "finish"
open fun txtSwitchFingersTitle(): String = "Switch to next Fingers"
open fun txtSwitchFingersBtnOk(): String = "OK"
open fun txtScanIntroTitle(): String = "Hand scanning introduction"
open fun txtScanIntroText(): String = " 1. Hold your fingers under the phone \n 2. Make sure that your fingers fits into the screen \n 3. Move your fingers slowly to get green boxes \n 4. Continue with next fingers"
/**
* Custom texts calibration screen.
*/
open fun txtCalibrationIntroTitle(): String = "ID calibration introduction"
open fun txtCalibrationIntroText(): 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() : BcmBranding() {
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 BcmBranding {
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 BcmGlobalConfig class
Kotlin:
class BcmGlobalConfig() : BcmGlobalConfig() {
override fun branding(): BcmBranding = BcmBranding()
}
Java:
public class BcmGlobalConfig extends BcmGlobalConfig {
public BcmGlobalConfig() {
super();
}
@Override
public BcmBranding branding() {
return new BcmBranding();
}
}