package com.key.vibekeyboard.Adapter;

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

import com.key.vibekeyboard.Fragment.FavoriteFragment;
import com.key.vibekeyboard.Fragment.HomeFragment;
import com.key.vibekeyboard.Fragment.SettingFragment;

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 HomeFragment());
        fragmentList.add(new FavoriteFragment());
        fragmentList.add(new SettingFragment());

    }

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

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