private void recycleActiveViews() { // remove and recycle the currently active views if (mPreviousPage.valid) { removeView(mPreviousPage.v); mRecycler.addScrapView(mPreviousPage.v, mPreviousPage.position, mPreviousPage.viewType); mPreviousPage.valid = false; } if (mCurrentPage.valid) { removeView(mCurrentPage.v); mRecycler.addScrapView(mCurrentPage.v, mCurrentPage.position, mCurrentPage.viewType); mCurrentPage.valid = false; } if (mNextPage.valid) { removeView(mNextPage.v); mRecycler.addScrapView(mNextPage.v, mNextPage.position, mNextPage.viewType); mNextPage.valid = false; } }
private void fillPageForIndex(Page p, int i) { p.position = i; p.viewType = mAdapter.getItemViewType(p.position); p.v = getView(p.position, p.viewType); p.valid = true; }