Fix inactive tab onResume update when there are 3 tabs
This commit is contained in:
parent
152ef60d24
commit
fca700375a
|
@ -70,11 +70,11 @@ class MainActivity : SimpleActivity() {
|
|||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
setupTabColors()
|
||||
updateMenuColors()
|
||||
if (getPagerAdapter()?.showRecycleBin != config.useRecycleBin) {
|
||||
setupViewPager()
|
||||
}
|
||||
setupTabColors()
|
||||
getPagerAdapter()?.onResume()
|
||||
}
|
||||
|
||||
|
@ -207,9 +207,13 @@ class MainActivity : SimpleActivity() {
|
|||
|
||||
private fun setupTabColors() {
|
||||
val activeView = binding.mainTabsHolder.getTabAt(binding.viewPager.currentItem)?.customView
|
||||
val inactiveView = binding.mainTabsHolder.getTabAt(getInactiveTabIndex())?.customView
|
||||
updateBottomTabItemColors(activeView, true)
|
||||
updateBottomTabItemColors(inactiveView, false)
|
||||
for (i in 0 until binding.mainTabsHolder.tabCount) {
|
||||
if (i != binding.viewPager.currentItem) {
|
||||
val inactiveView = binding.mainTabsHolder.getTabAt(i)?.customView
|
||||
updateBottomTabItemColors(inactiveView, false)
|
||||
}
|
||||
}
|
||||
|
||||
binding.mainTabsHolder.getTabAt(binding.viewPager.currentItem)?.select()
|
||||
val bottomBarColor = getBottomNavigationBackgroundColor()
|
||||
|
@ -217,8 +221,6 @@ class MainActivity : SimpleActivity() {
|
|||
updateNavigationBarColor(bottomBarColor)
|
||||
}
|
||||
|
||||
private fun getInactiveTabIndex() = if (binding.viewPager.currentItem == 0) 1 else 0
|
||||
|
||||
private fun getPagerAdapter() = (binding.viewPager.adapter as? ViewPagerAdapter)
|
||||
|
||||
private fun launchSettings() {
|
||||
|
|
Loading…
Reference in New Issue