package com.cooleshow.student.adapter;

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

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

import com.cooleshow.base.ui.fragment.BaseMVPFragment;

/**
 * Author by pq, Date on 2022/4/20.
 */
public class MineCoursePagerAdapter extends FragmentStateAdapter {
    private List<BaseMVPFragment> mFragments;

    public void setFragments(List<BaseMVPFragment> fragments) {
        this.mFragments = fragments;
    }

    public MineCoursePagerAdapter(@NonNull FragmentActivity fragmentActivity) {
        super(fragmentActivity);
    }

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

    @Override
    public int getItemCount() {
        return mFragments != null ? mFragments.size() : 0;
    }
}
