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 = "Left Hand"
open fun txtScanFragmentStatusRightHand(): String = "Right Hand"
open fun txtScanFragmentStatusThumbs(): String = "Thumbs"
open fun txtScanFragmentBtnFinish(): String = "cancel"
}
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();
}
}