Search in sources :

Example 1 with PagerModelManager

use of github.chenupt.multiplemodel.viewpager.PagerModelManager 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);
}
Also used : PagerModelManager(github.chenupt.multiplemodel.viewpager.PagerModelManager) ModelPagerAdapter(github.chenupt.multiplemodel.viewpager.ModelPagerAdapter) SpringIndicator(github.chenupt.springindicator.SpringIndicator) Toolbar(android.support.v7.widget.Toolbar)

Example 2 with PagerModelManager

use of github.chenupt.multiplemodel.viewpager.PagerModelManager 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);
}
Also used : PagerModelManager(github.chenupt.multiplemodel.viewpager.PagerModelManager) ModelPagerAdapter(github.chenupt.multiplemodel.viewpager.ModelPagerAdapter)

Aggregations

ModelPagerAdapter (github.chenupt.multiplemodel.viewpager.ModelPagerAdapter)2 PagerModelManager (github.chenupt.multiplemodel.viewpager.PagerModelManager)2 Toolbar (android.support.v7.widget.Toolbar)1 SpringIndicator (github.chenupt.springindicator.SpringIndicator)1