Use the tab's contentDescription as the toolbar title (#3609)

Previous code had an IndexOutOfBoundsException where tab.position could be larger than the tabs array.
This commit is contained in:
Nik Clayton 2023-05-04 13:19:44 +02:00 committed by GitHub
parent 4da758c1f7
commit a7001eecb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -737,7 +737,7 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInje
onTabSelectedListener = object : OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab) {
binding.mainToolbar.title = tabs[tab.position].title(this@MainActivity)
binding.mainToolbar.title = tab.contentDescription
refreshComposeButtonState(tabAdapter, tab.position)
}