package com.ardraw.ardrawingflow.ui.adapter;

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

import com.ardraw.ardrawingflow.ui.fragment.AddFragment;
import com.ardraw.ardrawingflow.ui.fragment.CategoryFragment;
import com.ardraw.ardrawingflow.ui.fragment.FavoriteFragment;

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

public class MainViewPager2Adapter extends FragmentStateAdapter {
    private final List<Fragment> fragmentList;

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

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

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