@Override
    protected void dispatchDraw(Canvas canvas) {

        if (mPageCount < 1) {
            return;
        }

        if (!mScroller.isFinished() && mScroller.computeScrollOffset()) {
            setFlipDistance(mScroller.getCurrY());
        }

        if (mIsFlipping || !mScroller.isFinished() || mPeakAnim != null) {
            showAllPages();
            drawPreviousHalf(canvas);
            drawNextHalf(canvas);
            drawFlippingHalf(canvas);
        } else {
            endScroll();
            setDrawWithLayer(mCurrentPage.v, false);
            hideOtherPages(mCurrentPage);
            drawChild(canvas, mCurrentPage.v, 0);

            // dispatch listener event now that we have "landed" on a page.
            // TODO not the prettiest to have this with the drawing logic,
            // should change.
            if (mLastDispatchedPageEventIndex != mCurrentPageIndex) {
                mLastDispatchedPageEventIndex = mCurrentPageIndex;
                postFlippedToPage(mCurrentPageIndex);
            }
        }

        // if overflip is GLOW mode and the edge effects needed drawing, make
        // sure to invalidate
        if (mOverFlipper.draw(canvas)) {
            // always invalidate whole screen as it is needed 99% of the time.
            // This is because of the shadows and shines put on the non-flipping
            // pages
            invalidate();
        }
    }
@author emilsjolander
        <p>
        Class to hold a view and its corresponding info
app/src/main/java/home/smart/fly/animations/customview/flipview/FlipView.java