package com.fun.funnyprank.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.fun.funnyprank.fragment.CustomFragment;
import com.fun.funnyprank.fragment.LikeFragment;
import com.fun.funnyprank.fragment.MainFragment;
import com.fun.funnyprank.fragment.RankFragment;

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

public class PageAdapter extends FragmentPagerAdapter {
    private List<Fragment> fragmentList = new ArrayList<>();

    public PageAdapter(@NonNull FragmentManager fm) {
        super(fm);
        fragmentList.add(new MainFragment());
        fragmentList.add(new CustomFragment());
        fragmentList.add(new RankFragment());
        fragmentList.add(new LikeFragment());
    }

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

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