Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class PagerIndicator extends View {
// Constructors and other methods
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (isInEditMode()) {
drawDots(canvas, 5, 2);
return;
}
if (pager != null) {
int total = pager.getAdapter().getCount();
int currentPage = pager.getCurrentItem();
drawDots(canvas, total, currentPage);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment