use of github.chenupt.multiplemodel.viewpager.ModelPagerAdapter in project SpringIndicator by chenupt.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
viewPager = (ScrollerViewPager) findViewById(R.id.view_pager);
SpringIndicator springIndicator = (SpringIndicator) findViewById(R.id.indicator);
Toolbar toolbar = (Toolbar) findViewById(R.id.tool_bar);
setSupportActionBar(toolbar);
PagerModelManager manager = new PagerModelManager();
manager.addCommonFragment(GuideFragment.class, getBgRes(), getTitles());
ModelPagerAdapter adapter = new ModelPagerAdapter(getSupportFragmentManager(), manager);
viewPager.setAdapter(adapter);
viewPager.fixScrollSpeed();
// just set viewPager
springIndicator.setViewPager(viewPager);
}
use of github.chenupt.multiplemodel.viewpager.ModelPagerAdapter in project DragTopLayout by chenupt.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.tool_bar);
viewPager = (ViewPager) findViewById(R.id.view_pager);
dragLayout = (DragTopLayout) findViewById(R.id.drag_layout);
topImageView = (ImageView) findViewById(R.id.image_view);
pagerSlidingTabStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs);
toolbar.setTitle("DragTopLayout");
setSupportActionBar(toolbar);
// Optional setting or set them in your xml.
// dragLayout.setOverDrag(true)
// .setCollapseOffset(100)
// .listener(new DragTopLayout.SimplePanelListener() {
// @Override
// public void onSliding(float ratio) {
// super.onSliding(ratio);
// }
// })
// .closeTopView(false);
// init pager
PagerModelManager factory = new PagerModelManager();
factory.addCommonFragment(getFragments(), getTitles());
adapter = new ModelPagerAdapter(getSupportFragmentManager(), factory);
viewPager.setAdapter(adapter);
pagerSlidingTabStrip.setViewPager(viewPager);
}
Aggregations