Skip to content

Commit

Permalink
fix: Ensure actionbar title is set correctly (#628)
Browse files Browse the repository at this point in the history
#589 changed the initial
setting of the action bar title to use `binding.mainToolbar.title`
instead of `supportActionBar?.title`.

Not sure why, but this doesn't work on first use, and was showing
"Pachli Current" until the user changes tabs. Swap one usage back to
`supportActionBar?.title` to fix this, and update the other to do the
same thing to keep the code consistent.
  • Loading branch information
nikclayton authored Apr 15, 2024
1 parent 8a2ba41 commit b8939dd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/app/pachli/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvider {

onTabSelectedListener = object : OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab) {
binding.mainToolbar.title = tab.contentDescription
supportActionBar?.title = tabs[tab.position].title(this@MainActivity)

refreshComposeButtonState(tabs[tab.position])
}
Expand All @@ -962,7 +962,7 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvider {
activeTabLayout.addOnTabSelectedListener(it)
}

binding.mainToolbar.title = tabs[position].title(this@MainActivity)
supportActionBar?.title = tabs[position].title(this@MainActivity)
binding.mainToolbar.setOnClickListener {
(tabAdapter.getFragment(activeTabLayout.selectedTabPosition) as? ReselectableFragment)?.onReselect()
}
Expand Down

0 comments on commit b8939dd

Please sign in to comment.