package com.ar.arsketch.adapter;

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

import com.ar.arsketch.fragment.CategoryFragment;

import java.util.List;


public class CategoryViewPager2Adapter extends FragmentStateAdapter {

    private final List<String> categories;

    public CategoryViewPager2Adapter(@NonNull FragmentActivity fragmentActivity, List<String> categories) {
        super(fragmentActivity);
        this.categories = categories;
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {

        String category = categories.get(position);
        return CategoryFragment.newInstance(category);
    }

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

}
