package com.hanwha.morakmorak.ui.main

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter
import com.hanwha.morakmorak.ui.main.chat.ChatFragment
import com.hanwha.morakmorak.ui.main.home.HomeFragment
import com.hanwha.morakmorak.ui.main.mypage.MyPageFragment
import com.hanwha.morakmorak.ui.main.people.PeopleFragment

/**
 * Created by aaron on 06/09/2019
 */

class MainPagerAdapter(fm: FragmentManager) : FragmentStatePagerAdapter(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {

    private val fragmentTitleList = listOf("Home", "People", "Chat", "My page")

    override fun getItem(position: Int): Fragment {

        return when(position) {
            0 -> HomeFragment()

            1 -> PeopleFragment()

            2 -> ChatFragment()

            3 -> MyPageFragment()

            else -> HomeFragment()
        }
    }

    override fun getCount() = 4

    override fun getPageTitle(position: Int) = fragmentTitleList[position]


}