package com.itant.shiwushu.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.itant.shiwushu.ui.menu.sub.PostFragment;

import java.util.List;

/**
 * Created by Jason on 2018/8/20.
 */

public class TabPageAdapter extends FragmentPagerAdapter {

    private List<PostFragment> tabFragments;
    public TabPageAdapter(FragmentManager fm, List<PostFragment> fragments) {
        super(fm);
        this.tabFragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return tabFragments == null ? null : tabFragments.get(position);
    }

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