use of me.relex.circleindicator.sample.SamplePagerAdapter in project CircleIndicator by ongakuer.
the class DynamicAdapterFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
view.findViewById(R.id.add).setOnClickListener(this);
view.findViewById(R.id.remove).setOnClickListener(this);
mAdapter = new SamplePagerAdapter(1) {
@Override
public int getItemPosition(Object object) {
return POSITION_NONE;
}
};
ViewPager viewpager = (ViewPager) view.findViewById(R.id.viewpager);
CircleIndicator indicator = (CircleIndicator) view.findViewById(R.id.indicator);
viewpager.setAdapter(mAdapter);
indicator.setViewPager(viewpager);
mAdapter.registerDataSetObserver(indicator.getDataSetObserver());
}
use of me.relex.circleindicator.sample.SamplePagerAdapter in project CircleIndicator by ongakuer.
the class ResetAdapterFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
mViewpager = (ViewPager) view.findViewById(R.id.viewpager);
mIndicator = (CircleIndicator) view.findViewById(R.id.indicator);
mViewpager.setAdapter(new SamplePagerAdapter(5));
mIndicator.setViewPager(mViewpager);
view.findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mViewpager.setAdapter(new SamplePagerAdapter(1 + mRandom.nextInt(5)));
mIndicator.setViewPager(mViewpager);
}
});
}
Aggregations