use filled/empty icons at bottom tabs
This commit is contained in:
parent
fa7e173150
commit
6c3d12fa84
|
@ -62,7 +62,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:d82297ad77'
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:e843eab1a5'
|
||||
implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61'
|
||||
implementation 'me.grantland:autofittextview:0.2.1'
|
||||
}
|
||||
|
|
|
@ -283,11 +283,11 @@ class MainActivity : SimpleActivity() {
|
|||
|
||||
private fun setupTabColors() {
|
||||
val activeView = main_tabs_holder.getTabAt(view_pager.currentItem)?.customView
|
||||
updateBottomTabItemColors(activeView, true)
|
||||
updateBottomTabItemColors(activeView, true, getSelectedTabDrawableIds()[view_pager.currentItem])
|
||||
|
||||
getInactiveTabIndexes(view_pager.currentItem).forEach { index ->
|
||||
val inactiveView = main_tabs_holder.getTabAt(index)?.customView
|
||||
updateBottomTabItemColors(inactiveView, false)
|
||||
updateBottomTabItemColors(inactiveView, false, getDeselectedTabDrawableIds()[index])
|
||||
}
|
||||
|
||||
val bottomBarColor = getBottomNavigationBackgroundColor()
|
||||
|
@ -297,6 +297,18 @@ class MainActivity : SimpleActivity() {
|
|||
|
||||
private fun getInactiveTabIndexes(activeIndex: Int) = (0 until tabsList.size).filter { it != activeIndex }
|
||||
|
||||
private fun getSelectedTabDrawableIds() = arrayOf(
|
||||
R.drawable.ic_person_vector,
|
||||
R.drawable.ic_star_vector,
|
||||
R.drawable.ic_clock_filled_vector
|
||||
)
|
||||
|
||||
private fun getDeselectedTabDrawableIds() = arrayOf(
|
||||
R.drawable.ic_person_outline_vector,
|
||||
R.drawable.ic_star_outline_vector,
|
||||
R.drawable.ic_clock_vector
|
||||
)
|
||||
|
||||
private fun initFragments() {
|
||||
view_pager.offscreenPageLimit = 2
|
||||
view_pager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
|
||||
|
@ -363,12 +375,12 @@ class MainActivity : SimpleActivity() {
|
|||
|
||||
main_tabs_holder.onTabSelectionChanged(
|
||||
tabUnselectedAction = {
|
||||
updateBottomTabItemColors(it.customView, false)
|
||||
updateBottomTabItemColors(it.customView, false, getDeselectedTabDrawableIds()[it.position])
|
||||
},
|
||||
tabSelectedAction = {
|
||||
closeSearch()
|
||||
view_pager.currentItem = it.position
|
||||
updateBottomTabItemColors(it.customView, true)
|
||||
updateBottomTabItemColors(it.customView, true, getSelectedTabDrawableIds()[it.position])
|
||||
}
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue