Search in sources :

Example 1 with PagesAdapter

use of com.shizhefei.test.view.adapters.PagesAdapter in project MVCHelper by LuckyJayce.

the class CoolActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_more_views);
    Indicator indicator = (Indicator) findViewById(R.id.moreviews_indicatorView);
    ViewPager viewPager = (ViewPager) findViewById(R.id.moreviews_viewPager);
    headTextView = (TextView) findViewById(R.id.moreviews_headtext_textView);
    Class[] fragments = { StateHeaderFragment.class, JellyHeaderFragment.class, MaterialHeaderFragment.class, PinContentMaterialHeaderFragment.class };
    indicator.setScrollBar(new ColorBar(this, ContextCompat.getColor(this, R.color.primary), DisplayUtil.dipToPix(this, 3)));
    indicator.setOnTransitionListener(new OnTransitionTextListener().setColor(Color.BLACK, Color.GRAY));
    viewPager.setOffscreenPageLimit(2);
    indicatorViewPager = new IndicatorViewPager(indicator, viewPager);
    indicatorViewPager.setAdapter(pagesAdapter = new PagesAdapter(getSupportFragmentManager(), fragments));
}
Also used : IndicatorViewPager(com.shizhefei.view.indicator.IndicatorViewPager) OnTransitionTextListener(com.shizhefei.view.indicator.transition.OnTransitionTextListener) IndicatorViewPager(com.shizhefei.view.indicator.IndicatorViewPager) ViewPager(android.support.v4.view.ViewPager) Indicator(com.shizhefei.view.indicator.Indicator) ColorBar(com.shizhefei.view.indicator.slidebar.ColorBar) PagesAdapter(com.shizhefei.test.view.adapters.PagesAdapter)

Aggregations

ViewPager (android.support.v4.view.ViewPager)1 PagesAdapter (com.shizhefei.test.view.adapters.PagesAdapter)1 Indicator (com.shizhefei.view.indicator.Indicator)1 IndicatorViewPager (com.shizhefei.view.indicator.IndicatorViewPager)1 ColorBar (com.shizhefei.view.indicator.slidebar.ColorBar)1 OnTransitionTextListener (com.shizhefei.view.indicator.transition.OnTransitionTextListener)1