package com.hanwha.morakmorak.ui.main.home.detail

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter
import com.hanwha.morakmorak.ui.main.home.detail.chat.DetailChatFragment
import com.hanwha.morakmorak.ui.main.home.detail.info.DetailInfoFragment

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

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

    private val fragmentTitleList = listOf("정보", "채팅")

    override fun getItem(position: Int): Fragment {

        return when(position) {
            0 -> DetailInfoFragment.newInstance()

            1 -> DetailChatFragment.newInstance()

            else -> DetailInfoFragment.newInstance()
        }
    }

    override fun getCount() = 2

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


}