Skip to content

Instantly share code, notes, and snippets.

@SamueldaCostaAraujoNunes
Created August 18, 2021 13:09
Show Gist options
  • Save SamueldaCostaAraujoNunes/596ed7b2b65c0e1ee8ae0bb3abc80f87 to your computer and use it in GitHub Desktop.
Save SamueldaCostaAraujoNunes/596ed7b2b65c0e1ee8ae0bb3abc80f87 to your computer and use it in GitHub Desktop.
binding.tabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab?) {
val position = tab?.position ?: 0
val gameType: GameType = GameType.values()[position]
setListeners(gameType)
}
override fun onTabReselected(tab: TabLayout.Tab?) {}
override fun onTabUnselected(tab: TabLayout.Tab?) {}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment