private void renderNextPageIfNotRendered() { WeiboPageView renderingPageView; if (forward) { renderingPageView = next; } else { renderingPageView = previous; } if (renderingPageView.isRendered()) return; for (ArticleView v : renderingPageView.getWeiboViews()) { v.renderBeforeLayout(); } renderingPageView.renderBeforeLayout(); renderingPageView.setVisibility(View.VISIBLE); }
private void showAnimation() { enlargedMode = false; renderNextPageIfNotRendered(); // Log.d("ANI", "start animation"); container.removeAllViews(); if (current.isFirstPage()) { next.setVisibility(View.VISIBLE); currentPageIndex++; container.addView(current, pageViewLayoutParamsBack); container.addView(next, pageViewLayoutParamsFront); current.startAnimation(fadeInPageView); } else if (isWeiboMode() || next.isLastPage() || next.getWrapperViews().size() < 2 || lastFlipDirection == ACTION_HORIZONTAL) { Animation rotation = buildFlipHorizonalAnimation(forward); if (forward) next.setVisibility(View.VISIBLE); else previous.setVisibility(View.VISIBLE); if (forward) { currentPageIndex++; container.addView(current, pageViewLayoutParamsBack); container.addView(next, pageViewLayoutParamsFront); current.startAnimation(rotation); } else { container.addView(current, pageViewLayoutParamsFront); container.addView(previous, pageViewLayoutParamsBack); previous.startAnimation(rotation); } } else { if (forward) { currentPageIndex++; container.addView(next, pageViewLayoutParamsFront); } else { container.addView(previous, pageViewLayoutParamsFront); } container.addView(current, pageViewLayoutParamsBack); if (forward) { currentUpper = current.getWrapperViews().get(0); currentBottom = current.getWrapperViews().get(1); nextUpper = next.getWrapperViews().get(0); nextBottom = next.getWrapperViews().get(1); final Animation flipToNext = buildFlipAnimation(currentUpper, currentBottom, nextUpper, nextBottom, true); currentBottom.startAnimation(flipToNext); } else { currentUpper = current.getWrapperViews().get(0); currentBottom = current.getWrapperViews().get(1); nextUpper = previous.getWrapperViews().get(0); nextBottom = previous.getWrapperViews().get(1); final Animation flipToPrevious = buildFlipAnimation(currentUpper, currentBottom, nextUpper, nextBottom, false); currentUpper.startAnimation(flipToPrevious); } } }