private void triggerOnPageChangeEvent(int position) {
        for (OnPageChangeListener eachListener : mOnPageChangeListeners) {
            if (eachListener != null) {
                InfinitePagerAdapter infiniteAdapter = (InfinitePagerAdapter)mAdapter;
                if (infiniteAdapter.getRealCount() == 0) {
                    return;
                }
                int n = position % infiniteAdapter.getRealCount();
                eachListener.onPageSelected(n);
            }
        }
        if (mInternalPageChangeListener != null) {
            mInternalPageChangeListener.onPageSelected(position);
        }
    }
Simple implementation of the {@link OnPageChangeListener} interface with stub
implementations of each method. Extend this if you do not intend to override
every method of {@link OnPageChangeListener}.
library/src/main/java/com/daimajia/slider/library/Tricks/ViewPagerEx.java