package com.wallpaper.wallpaperbox.ui.adapter;

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

import com.wallpaper.wallpaperbox.ui.fragment.HomeFragment;
import com.wallpaper.wallpaperbox.ui.fragment.LikeFragment;

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

public class MainAdapter extends FragmentStateAdapter {
    private final List<Fragment> fragmentList = new ArrayList<>();

    public MainAdapter(@NonNull FragmentActivity fragmentActivity) {
        super(fragmentActivity);
        fragmentList.add(new HomeFragment());
        fragmentList.add(new LikeFragment());
    }

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

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