package com.app.paintingstool.myadapter;

import android.util.Log;

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

import com.app.paintingstool.myfrg.PaintFragment;
import com.app.paintingstool.myuntils.Keys;

import java.util.List;

public class MyPagerAdapter extends FragmentStateAdapter {
    private final List<String> nameLists;

    public MyPagerAdapter(@NonNull FragmentActivity fragmentActivity) {
        super(fragmentActivity);
        this.nameLists = Keys.getAllDir();
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        Log.d("-----------------","-createFragment---"+position);
        return PaintFragment.newInstance(position);
    }

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