make use of the FAB at Select Contact activity

This commit is contained in:
tibbi
2019-12-06 22:51:06 +01:00
parent 324d9ef399
commit 3da4c170d8
5 changed files with 19 additions and 46 deletions

View File

@ -3,13 +3,14 @@ package com.simplemobiletools.contacts.pro.adapters
import android.view.View
import android.view.ViewGroup
import androidx.viewpager.widget.PagerAdapter
import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.activities.SimpleActivity
import com.simplemobiletools.contacts.pro.fragments.MyViewPagerFragment
import com.simplemobiletools.contacts.pro.helpers.CONTACTS_TAB_MASK
import com.simplemobiletools.contacts.pro.helpers.FAVORITES_TAB_MASK
import com.simplemobiletools.contacts.pro.helpers.GROUPS_TAB_MASK
class ViewPagerAdapter(val activity: SimpleActivity, val currTabsList: ArrayList<Int>, val showTabs: Int, val pagerFragments: ArrayList<Int>) : PagerAdapter() {
class ViewPagerAdapter(val activity: SimpleActivity, val currTabsList: ArrayList<Int>, val showTabs: Int) : PagerAdapter() {
override fun instantiateItem(container: ViewGroup, position: Int): Any {
val layout = getFragment(position)
@ -34,15 +35,15 @@ class ViewPagerAdapter(val activity: SimpleActivity, val currTabsList: ArrayList
private fun getFragment(position: Int): Int {
val fragments = arrayListOf<Int>()
if (showTabs and CONTACTS_TAB_MASK != 0) {
fragments.add(pagerFragments[0])
fragments.add(R.layout.fragment_contacts)
}
if (showTabs and FAVORITES_TAB_MASK != 0) {
fragments.add(pagerFragments[1])
fragments.add(R.layout.fragment_favorites)
}
if (showTabs and GROUPS_TAB_MASK != 0) {
fragments.add(pagerFragments[2])
fragments.add(R.layout.fragment_groups)
}
return fragments[position]