package com.itant.joycity.adapter;

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

import java.util.List;

/**
 * Created by Jason on 2016/10/6.
 */
public class FragmentAdapter extends FragmentPagerAdapter {

    private List<Fragment> fragments;

    public FragmentAdapter(FragmentManager fm, List<Fragment> fragments) {
        super(fm);
        this.fragments =fragments;
    }


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


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