use of com.github.obsessive.simplifyreader.ui.adpter.ImagesContainerPagerAdapter in project SimplifyReader by chentao0707.
the class ImagesContainerFragment method initializePagerViews.
@Override
public void initializePagerViews(final List<BaseEntity> categoryList) {
if (null != categoryList && !categoryList.isEmpty()) {
mViewPager.setOffscreenPageLimit(categoryList.size());
mViewPager.setAdapter(new ImagesContainerPagerAdapter(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) {
ImagesListFragment fragment = (ImagesListFragment) mViewPager.getAdapter().instantiateItem(mViewPager, position);
fragment.onPageSelected(position, categoryList.get(position).getId());
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
}
}
Aggregations