removing some magic numbers

This commit is contained in:
tibbi 2018-10-26 12:29:12 +02:00
parent 870c325032
commit e5d1043962
1 changed files with 3 additions and 3 deletions

View File

@ -304,10 +304,10 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
} }
} }
private fun getInactiveTabIndexes(activeIndex: Int) = arrayListOf(0, 1, 2, 3).filter { it != activeIndex } private fun getInactiveTabIndexes(activeIndex: Int) = (0 until tabsList.size).filter { it != activeIndex }
private fun initFragments() { private fun initFragments() {
viewpager.offscreenPageLimit = 3 viewpager.offscreenPageLimit = tabsList.size - 1
viewpager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener { viewpager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageScrollStateChanged(state: Int) { override fun onPageScrollStateChanged(state: Int) {
if (isSearchOpen) { if (isSearchOpen) {
@ -368,7 +368,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
}, 100L) }, 100L)
} }
main_tabs_holder.beVisibleIf(skippedTabs < 3) main_tabs_holder.beVisibleIf(skippedTabs < tabsList.size - 1)
main_dialpad_button.setOnClickListener { main_dialpad_button.setOnClickListener {
val intent = Intent(applicationContext, DialpadActivity::class.java) val intent = Intent(applicationContext, DialpadActivity::class.java)