package ch.pizzaleu.android.adapter.pager;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;

import ch.pizzaleu.android.fragment.CampaignBannerFragment;
import ch.pizzaleu.android.model.CampaignBannerModel;

public class CampaignBannerPagerAdapter extends FragmentPagerAdapter {

    private ArrayList<CampaignBannerModel> campaignBannerList = new ArrayList<>();

    public CampaignBannerPagerAdapter(FragmentManager fm,
                                      ArrayList<CampaignBannerModel> campaignBannerList) {
        super(fm);
        this.campaignBannerList = campaignBannerList;
    }

    @Override
    public Fragment getItem(int position) {
        return CampaignBannerFragment.newInstance(campaignBannerList.get(position));
    }

    @Override
    public int getCount() {
        return campaignBannerList.size();
    }
}