com.tomtom.sdk.asset:road-shield-icon-provider
The Road Shield Icon Provider module provides the RoadShieldIconProvider class, which generates road shield and exit sign images for use within the application UI. It provides production-ready bitmap generation with support for day/night themes, automatic DPI scaling, and regional sign variations.
Key Features
Guidance Instruction Integration: Seamlessly works with guidance instruction IconReference values
Style Modes: Supports light (day) and dark (night) themes via StyleMode
DPI Awareness: Automatic scaling based on device density with custom DPI support
Regional Support: Handles different road shield and exit sign styles by region
Fallback Generation: Creates fallback images when references cannot be resolved
Main API
The primary API is the RoadShieldIconProvider class, which provides:
provideRoadShieldIcon()- Generate a road shield image from a road shield referenceprovideExitSignIcon()- Generate an exit sign image from an exit sign referencestyleModeproperty - Control day/night theme appearance
Quick Start
// Initialize provider
val provider = RoadShieldIconProvider(applicationContext)
// Set dark/night mode (optional)
provider.styleMode = StyleMode.Dark
// Generate road shield images from guidance instruction
val imageList = guidanceInstruction?.nextSignificantRoad?.shields?.map { roadShield ->
provider.provideRoadShieldIcon(
reference = roadShield.iconReference,
content = roadShield.shieldContent,
).value().toAndroidBitmap()
}.orEmpty()
// Generate exit sign image from guidance instruction
val exitSignImage = guidanceInstruction?.signpost?.exitIconReference?.let { exitIconReference ->
val exitNumber = guidanceInstruction?.signpost?.exitNumber.orEmpty()
provider.provideExitSignIcon(
reference = exitIconReference,
content = exitNumber,
).value().toAndroidBitmap()
}Custom DPI Configuration
private const val TARGET_DPI = 240
val customConfig = applicationContext.resources.configuration.apply {
densityDpi = TARGET_DPI
}
val provider = RoadShieldIconProvider(
context = applicationContext.createConfigurationContext(customConfig)
)