From a7001eecb8615e5cc52672610a79e4b9a196f03a Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Thu, 4 May 2023 13:19:44 +0200 Subject: [PATCH] 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. --- app/src/main/java/com/keylesspalace/tusky/MainActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt b/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt index eeda8cb2..c70e8368 100644 --- a/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt @@ -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) }