use of com.qslll.expandingpager.adapter.TravelViewPagerAdapter in project ExpandingPager by qs-lll.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
setupWindowAnimations();
TravelViewPagerAdapter adapter = new TravelViewPagerAdapter(getSupportFragmentManager());
adapter.addAll(generateTravelList());
viewPager.setAdapter(adapter);
ExpandingPagerFactory.setupViewPager(viewPager);
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
ExpandingFragment expandingFragment = ExpandingPagerFactory.getCurrentFragment(viewPager);
if (expandingFragment != null && expandingFragment.isOpenend()) {
expandingFragment.close();
}
}
@Override
public void onPageSelected(int position) {
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
}
Aggregations