Search in sources :

Example 1 with Config

use of me.relex.circleindicator.Config in project CircleIndicator by ongakuer.

the class CustomAnimationFragment method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    int indicatorWidth = (int) (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, getResources().getDisplayMetrics()) + 0.5f);
    int indicatorHeight = (int) (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics()) + 0.5f);
    int indicatorMargin = (int) (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 6, getResources().getDisplayMetrics()) + 0.5f);
    ViewPager viewpager = view.findViewById(R.id.viewpager);
    CircleIndicator indicator = view.findViewById(R.id.indicator);
    Config config = new Config.Builder().width(indicatorWidth).height(indicatorHeight).margin(indicatorMargin).animator(R.animator.indicator_animator).animatorReverse(R.animator.indicator_animator_reverse).drawable(R.drawable.black_radius_square).build();
    indicator.initialize(config);
    viewpager.setAdapter(new SamplePagerAdapter());
    indicator.setViewPager(viewpager);
}
Also used : Config(me.relex.circleindicator.Config) CircleIndicator(me.relex.circleindicator.CircleIndicator) ViewPager(androidx.viewpager.widget.ViewPager) SamplePagerAdapter(me.relex.circleindicator.sample.SamplePagerAdapter)

Aggregations

ViewPager (androidx.viewpager.widget.ViewPager)1 CircleIndicator (me.relex.circleindicator.CircleIndicator)1 Config (me.relex.circleindicator.Config)1 SamplePagerAdapter (me.relex.circleindicator.sample.SamplePagerAdapter)1