package com.kfzs.duanduan.mine;

import android.content.Context;
import android.os.Parcelable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * 礼包 fragment adapter
 * Created by Administrator on 2017/12/15.
 */

public class GiftpackListAdapter extends FragmentPagerAdapter {
    private List<Object> mListFragment = new ArrayList<>();
    private List<Object> mTitles = new ArrayList<>();

    public GiftpackListAdapter(FragmentManager fm, Context mContext) {
        super(fm);
    }

    public void add(Fragment fragment, String title) {
        mListFragment.add(fragment);
        mTitles.add(title);
    }

    @Override
    public Fragment getItem(int position) {
        return (Fragment) mListFragment.get(position);
    }

    @Override
    public int getCount() {
        return mListFragment.size();
    }

    @Override
    public int getItemPosition(Object object) {
        return super.getItemPosition(object);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return (CharSequence) mTitles.get(position);
    }

    @Override
    public Parcelable saveState() {
        return null;
    }
}
