private void dataSetChanged() {
        final int currentPage = mCurrentPageIndex;
        int newPosition = currentPage;

        // if the adapter has stable ids, try to keep the page currently on
        // stable.
        if (mAdapter.hasStableIds() && currentPage != INVALID_PAGE_POSITION) {
            newPosition = getNewPositionOfCurrentPage();
        } else if (currentPage == INVALID_PAGE_POSITION) {
            newPosition = 0;
        }

        // remove all the current views
        recycleActiveViews();
        mRecycler.setViewTypeCount(mAdapter.getViewTypeCount());
        mRecycler.invalidateScraps();

        mPageCount = mAdapter.getCount();

        // put the current page within the new adapter range
        newPosition = Math.min(mPageCount - 1,
                newPosition == INVALID_PAGE_POSITION ? 0 : newPosition);

        if (newPosition != INVALID_PAGE_POSITION) {
            // TODO pretty confusing
            // this will be correctly set in setFlipDistance method
            mCurrentPageIndex = INVALID_PAGE_POSITION;
            mFlipDistance = INVALID_FLIP_DISTANCE;
            flipTo(newPosition);
        } else {
            mFlipDistance = INVALID_FLIP_DISTANCE;
            mPageCount = 0;
            setFlipDistance(0);
        }

        updateEmptyStatus();
    }
@author emilsjolander
        <p>
        Class to hold a view and its corresponding info
app/src/main/java/home/smart/fly/animations/customview/flipview/FlipView.java