package com.tenlionsoft.baselib.core.widget.base;

import org.jetbrains.annotations.NotNull;

import java.util.List;

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

/**
 * 作者: adam
 * 日期: 2021/11/4 - 3:40 下午
 * 邮箱: itgaojian@163.com
 * 描述:
 */
public class BaseViewPage2Adapter extends FragmentStateAdapter {
    private List<BaseFragment> mFragments;

    public BaseViewPage2Adapter(@NonNull @NotNull FragmentActivity fragmentActivity, List<BaseFragment> fragments) {
        super(fragmentActivity);
        this.mFragments = fragments;
    }

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

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