package com.kfzs.duanduan.adp;

import android.os.Parcelable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

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

/**
 * Created by ljy on 2018/8/29.
 */

public class ViewPagerFragmentStateAdapter extends FragmentStatePagerAdapter {
    private List<Fragment> mList = new ArrayList<>();;

    public ViewPagerFragmentStateAdapter(FragmentManager fm) {
        super(fm);
    }
    public void addAll(List<Fragment> fragmentList) {
        mList.clear();
        mList.addAll(fragmentList);
    }

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

    @Override
    public int getCount() {
        return mList != null ? mList.size() : 0;
    }

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