package com.lc.myapplication.security.mysoundstwo.adapter;

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

import com.lc.myapplication.security.mysoundstwo.fragment.FavoriteFragment;
import com.lc.myapplication.security.mysoundstwo.fragment.RadioFragment;
import com.lc.myapplication.security.mysoundstwo.fragment.SoundsFragment;
import com.lc.myapplication.security.mysoundstwo.fragment.WinFragment;

public class FragmentAdapter extends FragmentStateAdapter {
    public FragmentAdapter(@NonNull FragmentActivity fragmentActivity) {
        super(fragmentActivity);
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        switch (position){
            case 0:
                return new SoundsFragment();
            case 1:
                return new RadioFragment();
            case 2:
                return new WinFragment();
            default:
                return new FavoriteFragment();
        }
    }

    @Override
    public int getItemCount() {
        return 4;
    }
}
