use of com.github.obsessive.simplifyreader.ui.adpter.VideosContainerPagerAdapter in project SimplifyReader by chentao0707.
the class VideosContainerFragment method initializePagerViews.
@Override
public void initializePagerViews(final List<BaseEntity> categoryList) {
if (null != categoryList && !categoryList.isEmpty()) {
mViewPager.setOffscreenPageLimit(categoryList.size());
mViewPager.setAdapter(new VideosContainerPagerAdapter(getSupportFragmentManager(), categoryList));
mSmartTabLayout.setViewPager(mViewPager);
mSmartTabLayout.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
VideosListFragment fragment = (VideosListFragment) mViewPager.getAdapter().instantiateItem(mViewPager, position);
fragment.onPageSelected(position, categoryList.get(position).getId());
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
}
}
Aggregations