Default UI - Customizing
In the specific platform sections, we learned how to configure the TireTreadScanView
. Without specifying any properties, the Default UI is automatically active.
-
Kotlin
-
Swift
val svConfig = TireTreadScanViewConfig()
TireTreadScanView(context = this, config = svConfig, callback = this, onInitializationFailed = { ex -> /* handle */ })
let svConfig = TireTreadScanViewConfig()
TireTreadScanViewKt.TireTreadScanView(context: self, config: svConfig) {
// Handle initialization error
}
While ready out of the box, the Default UI is also customizable.
By providing a custom DefaultUiConfig
object to the TireTreadScanViewConfig()
you can customize the texts, and also hide default elements as needed:
-
Kotlin
-
Swift
val customConfig = DefaultUiConfig().apply {
distanceIndicatorConfig.textMoveAway = "Afaste o dispositivo"
distanceIndicatorConfig.textMoveCloser = "Aproxime o dispositivo"
distanceIndicatorConfig.textOk = "Mantenha a distância"
}
val svConfig = TireTreadScanViewConfig().apply {
defaultUiConfig = customConfig
}
TireTreadScanView(context = this, config = svConfig, callback = this, onInitializationFailed = { ex -> /* handle */ })
let customUiConfig = DefaultUiConfig()
customUiConfig.distanceIndicatorConfig.textMoveAway = "Afaste o dispositivo"
customUiConfig.distanceIndicatorConfig.textMoveCloser = "Aproxime o dispositivo"
customUiConfig.distanceIndicatorConfig.textOk = "Mantenha a distância"
let svConfig = TireTreadScanViewConfig().apply {
defaultUiConfig = customUiConfig
}
TireTreadScanViewKt.TireTreadScanView(context: self, config: svConfig) {
// Handle initialization error
}
If any element information is not provided, its default values will be used. |
Here are the Default UI elements that can be customized, and their respective property names within the DefaultUiConfig
class:
Element | Property Name |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|