Avatar
The MapGptAvatar
is an animating avatar displayed on-screen. This guide covers how to use avatars and how to construct your own.
Using avatars
To update the avatar:
Dash.mapGptCompose.config.update {
it.build {
avatar = PrebuiltMapGptAvatars.mapboxyAvatar
}
}
Detaching Avatar from MapView
With MapGPT
, you can detach the avatar from the map view to position it more widely on the screen and use it independently of the application.
private var detachableUI: MapGptDetachableUI? = null
override fun onCreate(savedInstanceState: Bundle?) {
detachableUI = Dash.mapGptCompose.attachContent(binding.mapGptComposeView) {
Dash.mapGptCompose.Avatar()
}
}
override fun onDestroy() {
detachableUI?.detach()
detachableUI = null
}
Creating a custom avatar
With MapGPT
, you can introduce your custom avatar for a personalized experience. The avatar leverages a sequence of animations developed with the Lottie library. These animations formats will be extended in the future, but our first version is using the Lottie JSON format.
Dash.mapGptCompose.config.update {
it.build {
avatar = LottieMapGptAvatar(
name = "Petter",
listeningToUser = R.raw.ic_petter_listening_to_user,
userSpeaking = R.raw.ic_petter_user_speaking,
aiThinking = R.raw.ic_petter_ai_thinking,
aiSpeaking = R.raw.ic_petter_ai_speaking,
aiError = R.raw.ic_petter_ai_error,
aiIdle = R.raw.ic_petter_listening_to_user,
aiSleeping = R.raw.ic_petter_listening_to_user,
noMicPermission = R.raw.ic_petter_listening_to_user,
serviceDisconnected = R.raw.ic_petter_listening_to_user,
)
}
}
Avatar state descriptions
- Listening to User: The assistant is actively listening.
- User Speaking: Indicates that the user is now speaking.
- AI Thinking: Assistant is processing a response.
- AI Speaking: Assistant is communicating a message.
- AI Error: An error has been detected with the assistant.
- AI Idle: Assistant is on standby for the next command.
- AI Sleeping: Assistant hasn't been activated for an extended period.
- No Mic Permission: The app lacks permission to access the microphone.
- Service Disconnected: Assistant has lost connection and can't respond.
Was this page helpful?