Search in sources :

Example 1 with SpringBar

use of com.shizhefei.view.indicator.slidebar.SpringBar in project ViewPagerIndicator by LuckyJayce.

the class YearActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_year);
    ViewPager viewPager = (ViewPager) findViewById(R.id.year_viewPager);
    Indicator indicator = (RecyclerIndicatorView) findViewById(R.id.year_indicator);
    int selectColorId = Color.parseColor("#f8f8f8");
    int unSelectColorId = Color.parseColor("#010101");
    indicator.setOnTransitionListener(new OnTransitionTextListener().setColor(selectColorId, unSelectColorId));
    indicator.setScrollBar(new SpringBar(getApplicationContext(), Color.GRAY));
    viewPager.setOffscreenPageLimit(4);
    indicatorViewPager = new IndicatorViewPager(indicator, viewPager);
    indicatorViewPager.setAdapter(new YearAdapter(1800, 10000000));
    indicatorViewPager.setCurrentItem(2016 - 1800, false);
}
Also used : SpringBar(com.shizhefei.view.indicator.slidebar.SpringBar) 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) RecyclerIndicatorView(com.shizhefei.view.indicator.RecyclerIndicatorView)

Example 2 with SpringBar

use of com.shizhefei.view.indicator.slidebar.SpringBar in project ViewPagerIndicator by LuckyJayce.

the class SpringActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_spring);
    ViewPager viewPager = (ViewPager) findViewById(R.id.spring_viewPager);
    Indicator indicator = (ScrollIndicatorView) findViewById(R.id.spring_indicator);
    int selectColor = Color.parseColor("#f8f8f8");
    unSelectColor = Color.parseColor("#010101");
    indicator.setOnTransitionListener(new OnTransitionTextListener().setColor(selectColor, unSelectColor));
    indicator.setScrollBar(new SpringBar(getApplicationContext(), Color.GRAY));
    //        indicator.setScrollBar(new ColorBar(getApplicationContext(), Color.RED, 5));
    viewPager.setOffscreenPageLimit(4);
    indicatorViewPager = new IndicatorViewPager(indicator, viewPager);
    inflate = LayoutInflater.from(getApplicationContext());
    indicatorViewPager.setAdapter(adapter);
    indicatorViewPager.setCurrentItem(5, false);
}
Also used : SpringBar(com.shizhefei.view.indicator.slidebar.SpringBar) 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) ScrollIndicatorView(com.shizhefei.view.indicator.ScrollIndicatorView) Indicator(com.shizhefei.view.indicator.Indicator)

Aggregations

ViewPager (android.support.v4.view.ViewPager)2 Indicator (com.shizhefei.view.indicator.Indicator)2 IndicatorViewPager (com.shizhefei.view.indicator.IndicatorViewPager)2 SpringBar (com.shizhefei.view.indicator.slidebar.SpringBar)2 OnTransitionTextListener (com.shizhefei.view.indicator.transition.OnTransitionTextListener)2 RecyclerIndicatorView (com.shizhefei.view.indicator.RecyclerIndicatorView)1 ScrollIndicatorView (com.shizhefei.view.indicator.ScrollIndicatorView)1