package com.file.clean.q.view.guide;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;

import com.file.clean.q.business.admob.AdmobManager;

/**
 * 作者：马海钊
 * 时间：2025/3/27 14:25
 * 功能：
 */
public class ViewPagerAdapter extends FragmentStatePagerAdapter {
    public ViewPagerAdapter(@NonNull FragmentManager fm, int behavior) {
        super(fm, behavior);
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        if (getCount() == 4) {
            switch (position) {
                case 0:
                    return new GuideOneFragment();
                case 1:
                    return new GuideTwoFragment();
                case 2:
                    return new FullNativeFragment();
                case 3:
                    return new GuideThreeFragment();
                default:
                    return new GuideOneFragment();
            }
        } else {
            switch (position) {
                case 0:
                    return new GuideOneFragment();
                case 1:
                    return new GuideTwoFragment();
                case 2:
                    return new GuideThreeFragment();
                default:
                    return new GuideOneFragment();
            }
        }
    }

    @Override
    public int getCount() {
        if (AdmobManager.INSTANCE.isShowAdNative()) {
            return 4;
        } else return 3;
    }
}
