private void snapToPage(final int whichPage, final int where, int duration) {
		enableChildrenCache();

		boolean changingPages = whichPage != mCurrentPage;

		mNextPage = whichPage;

		View focusedChild = getFocusedChild();
		if (focusedChild != null && changingPages
				&& focusedChild == getChildAt(mCurrentPage)) {
			focusedChild.clearFocus();
		}

		final int delta;
		if (getChildAt(whichPage).getHeight() <= pageHeight || where == TOP) {
			delta = getChildAt(whichPage).getTop() - getScrollY();
		} else {
			delta = getChildAt(whichPage).getBottom() - pageHeight
					- getScrollY();
		}

		mScroller.startScroll(0, getScrollY(), 0, delta, duration);
		invalidate();

		if (!mPageChangedListeners.isEmpty() && changingPages) {
			for (OnVerticalPageChangeListener l : mPageChangedListeners) {
				l.onVerticalPageChanged(whichPage);
			}
		}
	}
@return true - if pages switching enabled, false - otherwise.
app/src/main/java/pro/alexzaitsev/freepager/library/view/core/VerticalPager.java