package com.prank.happypranksounds.ui.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import com.prank.happypranksounds.ui.fragment.CategoryFragment;
import com.prank.happypranksounds.ui.fragment.FavoriteFragment;
import com.prank.happypranksounds.ui.fragment.SoundFragment;

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

public class MainAdapter extends FragmentStateAdapter {

    private final List<Fragment> fragmentList;

    public MainAdapter(@NonNull FragmentActivity fragmentActivity) {
        super(fragmentActivity);
        fragmentList = new ArrayList<>();
        fragmentList.add(new CategoryFragment());
        fragmentList.add(new SoundFragment());
        fragmentList.add(new FavoriteFragment());
    }

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

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