private void setCurrentPageImmediate() {
        if (viewPager != null) {
            currentPage = viewPager.getCurrentItem();
        } else {
            currentPage = 0;
        }
        if (dotCenterX != null)
            selectedDotX = dotCenterX[Math.max(0, Math.min(currentPage, dotCenterX.length - 1))];
    }
An ink inspired widget for indicating pages in a {@link ViewPager}.
library/src/main/java/com/heinrichreimersoftware/materialintro/view/InkPageIndicator.java