Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
binding.toolbar.setNavigationOnClickListener {
when (navController.currentDestination?.id) {
R.id.searchFragment, R.id.gamesFragment, R.id.notificationsFragment -> {
if (onBackPressedDispatcher.hasEnabledCallbacks())
onBackPressedDispatcher.onBackPressed()
else
navController.navigateUp()
}
else -> navController.navigateUp()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment