package com.sunzn.navigator.sample.adpt;

import androidx.fragment.app.Fragment;

import com.sunzn.navigator.library.NavigatorPort;
import com.sunzn.navigator.sample.frgm.FindFragment;
import com.sunzn.navigator.sample.frgm.HomeFragment;
import com.sunzn.navigator.sample.frgm.MineFragment;
import com.sunzn.navigator.sample.frgm.ViewFragment;

public class NavigatorAdapter implements NavigatorPort {

    private static final String[] TAGS = {"Home", "View", "Find", "Mine"};

    @Override
    public int getCount() {
        return TAGS.length;
    }

    @Override
    public String getTag(int position) {
        return TAGS[position];
    }

    @Override
    public Fragment onCreateFragment(int position) {
        switch (position) {
            case 0:
                return HomeFragment.newInstance();
            case 1:
                return ViewFragment.newInstance();
            case 2:
                return FindFragment.newInstance();
            case 3:
                return MineFragment.newInstance();
            default:
                return null;
        }
    }

}
