package com.dahe.gldriver.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter
import java.util.ArrayList

/**
 * Created by Administrator on 2018/7/16 0016.
 */
class MyHomePagerAdapter : FragmentStatePagerAdapter {
    private lateinit var mTitles: Array<String>
    private var mFragments = ArrayList<Fragment>()

    constructor(fm: FragmentManager?) : super(fm!!) {}
    constructor(
        fm: FragmentManager?,
        mTitles: Array<String>,
        mFragments: ArrayList<Fragment>
    ) : super(
        fm!!) {
        this.mTitles = mTitles
        this.mFragments = mFragments
    }

    // 初始化每个页卡选项
    //    @Override
    //    public Object instantiateItem(ViewGroup arg0, int arg1) {
    //        // TODO Auto-generated method stub
    //        node_return super.instantiateItem(arg0, arg1);
    //    }
    override fun getCount(): Int {
        return mFragments.size
    }

    override fun getPageTitle(position: Int): CharSequence? {
        return mTitles[position]
    }

    override fun getItem(position: Int): Fragment {
        return mFragments[position]
    }
}