public WeekPager(Context context, AttributeSet attrs) { super(context, attrs); weekAdapter = new WeekAdapter(); date = new Date(); setOffscreenPageLimit(3); setAdapter(weekAdapter); startingPos = weekAdapter.getStartingPosition() + BADateUtil.weekday(date); setCurrentItem(startingPos); }
public int getCurrentPosition() { return getCurrentItem() % weekAdapter.getRealCount(); }
public Page getPage(int position) { return weekAdapter.getItem(position); }
// set current position public void setCurrentPosition(int position) { int offset = position - (getCurrentItem() % weekAdapter.getRealCount()); setCurrentItem(getCurrentItem() + offset, true); }