package com.bassbooster.soundeffects.equalizer.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter

class ViewPagerAdapter(
    fa: FragmentActivity, private val fragments: ArrayList<Fragment>
) : FragmentStateAdapter(fa) {
    override fun getItemCount(): Int = fragments.size

    override fun createFragment(position: Int): Fragment = fragments[position]
    fun getFragment(position: Int): Fragment? {
        if (position < 0 || position >= fragments.size) {
            return null
        }
        return fragments[position]
    }

}