package com.bokecc.cloudclass.demo.adapter;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;

public class HomeActivityViewPagerAdapter extends PagerAdapter {

    private ArrayList<View> viewList;

    public HomeActivityViewPagerAdapter(ArrayList<View> viewList){
        this.viewList = viewList;
    }

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

    @Override
    public boolean isViewFromObject( View view,  Object o) {
        return view == o;
    }


    @Override
    public Object instantiateItem( ViewGroup container, int position) {
        container.addView(viewList.get(position));
        return viewList.get(position);
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(viewList.get(position));
    }
}
