Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A custom navigator with a populated navigate method
class ChromeCustomTabsNavigator(
private val context: Context
) : Navigator<ChromeCustomTabsNavigator.Destination>() {
override fun navigate(destination: Destination, args: Bundle?, navOptions: NavOptions?, navigatorExtras: Extras?): NavDestination? {
val builder = CustomTabsIntent.Builder()
builder.setToolbarColor(ContextCompat.getColor(context, destination.toolbarColor))
builder.setSecondaryToolbarColor(ContextCompat.getColor(context, destination.secondaryToolbarColor))
val intent =
val uri = args?.getParcelable<Uri>("uri")
intent.launchUrl(context, uri)
return null // Do not add to the back stack, managed by Chrome Custom Tabs
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment