package com.Mihai.adapter;

import android.app.Fragment;
import android.app.FragmentManager;
import android.support.v13.app.FragmentStatePagerAdapter;

import com.Mihai.view.DiscoverFragment;
import com.Mihai.view.MoveFragment;
import com.Mihai.view.MsgFragment;
import com.Mihai.view.PopularFragment;

public class FragmentAdapter extends FragmentStatePagerAdapter {

    public FragmentAdapter(FragmentManager fm) {
        super(fm);
    }

    private String[] pageTitle = {"热门", "发现", "动态", "消息"};


    @Override
    public int getCount() {
        return pageTitle.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return pageTitle[position];
    }

	@Override
	public Fragment getItem(int position) {
		switch (position) {
        case 0:
            return new PopularFragment();
        case 1:
            return new DiscoverFragment();
        case 2:
            return new MoveFragment();
        case 3:
            return new MsgFragment();
        default:
            return null;
    }
	}
}
