Skip to content

Android SDK UI Customization ​

Restyle the CICReader Android SDK's chip-scanning screen — text, buttons, the NFC icon, the loading indicator, the container window and custom fonts — by passing a CICUIConfig into your CICConfig.

Adding CICUIConfig to CICConfig ​

Pass the uiConfig parameter when you build your CICConfig:

kotlin
val config = CICConfig(
  baseUrl           = "<BASE_URL>",
  connectTimeoutMs  = 60_000,
  readTimeoutMs     = 60_000,
  cacheScanStrategy = CICCacheScanStrategy.NO_CACHE,
  uiConfig          = CICUIConfig(...)
)
kotlin
class CICUIConfig {
  val cancelButton: ButtonElement? = null,
  val scanningGuide: TextElement? = null,
  val waitingForCard: TextElement? = null,
  val connectedCard: TextElement? = null,
  val verifyingCard: TextElement? = null,
  val readingText: TextElement? = null,
  val nfcIcon: ImageElement? = null,
  val loadingIndicator: ProgressBarElement? = null,
  val windowView: WindowElement? = null,
  val customFont: List<FontSource>? = null,
}

Parameters:

ParamTypeRequiredDefaultDescription
cancelButtonButtonElement?NonullThe cancel action button.
scanningGuideTextElement?NonullInstructional text shown while the user positions the card.
waitingForCardTextElement?NonullText shown while waiting for a card to enter the NFC field.
connectedCardTextElement?NonullText shown once the chip connects.
verifyingCardTextElement?NonullText shown during verification.
readingTextTextElement?NonullText shown while the chip is being read.
nfcIconImageElement?NonullThe NFC icon asset.
loadingIndicatorProgressBarElement?NonullThe loading spinner.
windowViewWindowElement?NonullThe scanner container window.
customFontList<FontSource>?NonullFonts to register before they can be referenced by name.

Core UI Elements ​

CICUIConfig is built from five element types:

FieldTypeDescription
TextElementclassCustomize text content, size, color and font.
ButtonElementclassStyle buttons — text, background, border.
ImageElementclassSet a custom icon or image asset.
ProgressBarElementclassConfigure loading indicator colors.
WindowElementclassAdjust window background and corner radii.

TextElement ​

Overrides the default string and styling for a scanner step.

kotlin
TextElement(
  text     = "My custom string",
  textSize = 12f,
  color    = Color.parseColor("#BB86FC"),
  fontName = "MyRoboto"
)
ParamTypeRequiredDefaultDescription
textStringNoSDK defaultThe display string.
textSizeFloatNoSDK defaultFont size.
colorIntNoSDK defaultARGB color via Color.parseColor("#rrggbb").
fontNameStringNoSDK defaultA font name registered through customFont.

ButtonElement ​

Styles an action button.

kotlin
ButtonElement(
  text            = TextElement("Cancel", textSize = 18f),
  backgroundColor = Color.parseColor("#008000"),
  strokeColor     = Color.parseColor("#fcba03"),
  borderRadius    = 32f
)
ParamTypeRequiredDefaultDescription
textTextElementNoSDK defaultA nested TextElement for the button label.
backgroundColorIntNoSDK defaultButton fill color.
strokeColorIntNoSDK defaultBorder color.
borderRadiusFloatNoSDK defaultCorner radius.

ImageElement ​

Replaces the NFC icon.

kotlin
ImageElement(
  path      = "ic_android_nfc_wave.png",
  assetType = AssetType.ASSET
)
ParamTypeRequiredDefaultDescription
pathStringYes—File name in assets/, or an absolute file path.
assetTypeAssetTypeYes—Source type: ASSET or FILE.

ProgressBarElement ​

Replaces the default spinner.

kotlin
ProgressBarElement(
  backgroundColor = Color.parseColor("#333333"),
  progressColor   = Color.parseColor("#BB86FC")
)
ParamTypeRequiredDefaultDescription
backgroundColorIntNoSDK defaultTrack color behind the progress indicator.
progressColorIntNoSDK defaultColor of the progress indicator itself.

WindowElement ​

Adjusts the container's look.

kotlin
WindowElement(
  backgroundColor   = Color.parseColor("#d9bd71"),
  topLeftRadius     = 32,
  topRightRadius    = 32,
  bottomLeftRadius  = 32,
  bottomRightRadius = 32
)
ParamTypeRequiredDefaultDescription
backgroundColorIntNoSDK defaultWindow background color.
topLeftRadiusIntNoSDK defaultTop-left corner radius.
topRightRadiusIntNoSDK defaultTop-right corner radius.
bottomLeftRadiusIntNoSDK defaultBottom-left corner radius.
bottomRightRadiusIntNoSDK defaultBottom-right corner radius.

Custom Fonts ​

Register fonts with FontSource before referencing them by fontName on any TextElement.

kotlin
CICUIConfig(
  customFont = listOf(
    FontSource.Asset(
      fontName = "MyRoboto",
      file     = "playwrite.ttf"
    ),
    FontSource.File(
      fontName = "GoogleSans",
      path     = iconWavePath
    )
  ),
  scanningGuide = TextElement(
    text     = "Please insert your card",
    textSize = 12f,
    color    = Color.parseColor("#BB86FC"),
    fontName = "MyRoboto"
  )
)
ParamTypeRequiredDefaultDescription
FontSource.Asset.fontNameStringYes—The name to register the font under.
FontSource.Asset.fileStringYes—Font file name in assets/.
FontSource.File.fontNameStringYes—The name to register the font under.
FontSource.File.pathStringYes—Absolute path to the font file.

INFO

A fontName on a TextElement only resolves if the same name was registered in customFont. An unregistered name falls back to the SDK default rather than raising an error, so a typo shows up as an unchanged typeface, not a crash.

Full Example ​

kotlin
val uiConfig = CICUIConfig(
  customFont = listOf(
    FontSource.Asset(fontName = "MyRoboto", file = "playwrite.ttf")
  ),
  scanningGuide = TextElement(
    text     = "Đặt thẻ CCCD lên mặt sau điện thoại",
    textSize = 12f,
    color    = Color.parseColor("#BB86FC"),
    fontName = "MyRoboto"
  ),
  cancelButton = ButtonElement(
    text            = TextElement("Huỷ", textSize = 18f),
    backgroundColor = Color.parseColor("#008000"),
    strokeColor     = Color.parseColor("#fcba03"),
    borderRadius    = 32f
  ),
  nfcIcon = ImageElement(
    path      = "ic_android_nfc_wave.png",
    assetType = AssetType.ASSET
  ),
  loadingIndicator = ProgressBarElement(
    backgroundColor = Color.parseColor("#333333"),
    progressColor   = Color.parseColor("#BB86FC")
  ),
  windowView = WindowElement(
    backgroundColor   = Color.parseColor("#d9bd71"),
    topLeftRadius     = 32,
    topRightRadius    = 32,
    bottomLeftRadius  = 32,
    bottomRightRadius = 32
  )
)

val config = CICConfig(
  baseUrl           = "<BASE_URL>",
  connectTimeoutMs  = 60_000,
  readTimeoutMs     = 60_000,
  cacheScanStrategy = CICCacheScanStrategy.NO_CACHE,
  uiConfig          = uiConfig
)

Next Steps ​

Developers