package cn.tee3.demo.View;

import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.ViewGroup;

import java.util.List;

public class VideoPagerAdapter extends FragmentPagerAdapter {

    private List<VideoFragment> fragmentList;

    public VideoPagerAdapter(FragmentManager fm, List<VideoFragment> fragmentList) {
        super(fm);
        this.fragmentList = fragmentList;
    }

    @Override
    public Fragment getItem(int i) {
        return fragmentList.get(i);
    }

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

    @NonNull
    @Override
    public Object instantiateItem(@NonNull ViewGroup container, int position) {
        return super.instantiateItem(container, position);

    }

    public void setFragmentList(List<VideoFragment> fragmentList) {
        this.fragmentList = fragmentList;
        notifyDataSetChanged();
    }
}