/*
 * Copyright (C) 2022 - Florindo Smilari (spherIC)
 */
package ch.spherIC.recurvebowsight.ui.calcsight;

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

public class CalculateSightCollectionAdapter extends FragmentStateAdapter {

    private final int itemsCount;

    public CalculateSightCollectionAdapter(Fragment fragment, int itemsCount) {
        super(fragment);
        this.itemsCount = itemsCount;
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        // Return a NEW fragment instance in createFragment(int)
        Fragment fragment = null;
        switch (position) {
            case 0:
                fragment = new CalculateSightParametersFragment();
                break;
            case 1:
                fragment = new CalculateSightTrajectoryFragment();
                break;
            case 2:
                fragment = new CalculateSightSightSettingFragment();
                break;

        }
        return fragment;
    }

    @Override
    public int getItemCount() {
        return this.itemsCount;
    }
}

