public void showNextPage() { this.setInAnimation(mRightInAnim); this.setOutAnimation(mLeftOutAnim); if (remaindContent != null) { drawTextPage(); } // 现在处于最后一页 if (this.getCurrentView().hashCode() == this.getChildAt(this.getChildCount() - 1).hashCode() && remaindContent == null) { if (onPageListener != null) { onPageListener.onLastPageListener(); } } else { this.showNext(); } }
@Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { if (this.getChildCount() > 0 && isTouchEnable) { // 根据划动量,切换viewflow if (e2.getX() - e1.getX() > 120) { // 从左向右滑动(左进右出) this.setInAnimation(mLeftInAnim); this.setOutAnimation(mRightOutAnim); if (this.getCurrentView().hashCode() == getChildAt(0).hashCode()) { if (onPageListener != null) { onPageListener.onStartPageListener(); } } else { this.showPrevious(); } } else if (e2.getX() - e1.getX() < -120) { // 从右向左滑动(右进左出) showNextPage(); } } // this.flipStart(); return true; }