Buggy code:
private static final float MIN_SCALE = 1.0F ; private static final float MAX_SCALE = 5.0F ; private static final float REFLOW_SCALE_FACTOR = 0.5F ; private static final boolean HORIZONTAL_SCROLLING = true ; private Adapter mAdapter ; private int mCurrent ; private boolean mResetLayout ; private final SparseArray < View > mChildViews = new SparseArray < View > ( 3 ) ; private final LinkedList < View > mViewCache = new LinkedList < View > ( ) ; private boolean mUserInteracting ; private boolean mScaling ; private float mScale = 1.0F ; private int mXScroll ; private int mYScroll ; private boolean mReflow = false ; private boolean mReflowChanged = false ; private final GestureDetector mGestureDetector ; private final ScaleGestureDetector mScaleGestureDetector ; private final Scroller mScroller ; private final Stepper mStepper ; private int mScrollerLastX ; private int mScrollerLastY ; static abstract class ViewMapper { abstract void applyToView ( View view ) { } } public ReaderView ( Context context ) { } public ReaderView ( Context context , AttributeSet attrs ) { } public ReaderView ( Context context , AttributeSet attrs , int defStyle ) { } public int getDisplayedViewIndex ( ) { } public void setDisplayedViewIndex ( int i ) { } public void moveToNext ( ) { } public void moveToPrevious ( ) { } private int smartAdvanceAmount ( int screenHeight , int max ) { } public void smartMoveForwards ( ) { } public void smartMoveBackwards ( ) { } public void resetupChildren ( ) { } public void applyToChildren ( ReaderView . ViewMapper mapper ) { } public void refresh ( boolean reflow ) { } protected void onChildSetup ( int i , View v ) { } protected void onMoveToChild ( int i ) { } protected void onMoveOffChild ( int i ) { } protected void onSettle ( View v ) { } protected void onUnsettle ( View v ) { } protected void onNotInUse ( View v ) { } protected void onScaleChild ( View v , Float scale ) { } public View getView ( int i ) { } public View getDisplayedView ( ) { } public void run ( ) { } public boolean onDown ( MotionEvent arg0 ) { } public boolean onFling ( MotionEvent e1 , MotionEvent e2 , float velocityX , float velocityY ) { if ( mScaling ) return true ; View v = mChildViews . get ( mCurrent ) ; if ( v != null ) { Rect bounds = getScrollBounds ( v ) ; switch ( ReaderView . directionOfTravel ( velocityX , velocityY ) ) { case ReaderView . MOVING_LEFT : if ( ( ReaderView . HORIZONTAL_SCROLLING ) && ( ( bounds . left ) >= 0 ) ) { View vl = mChildViews . get ( ( ( mCurrent ) + 1 ) ) ; if ( vl != null ) { slideViewOntoScreen ( vl ) ; return true ; } } break ; case ReaderView . MOVING_UP : if ( ( ! ( ReaderView . HORIZONTAL_SCROLLING ) ) && ( ( bounds . top ) >= 0 ) ) { View vl = mChildViews . get ( ( ( mCurrent ) + 1 ) ) ; if ( vl != null ) { slideViewOntoScreen ( vl ) ; return true ; } } break ; case ReaderView . MOVING_RIGHT : if ( ( ReaderView . HORIZONTAL_SCROLLING ) && ( ( bounds . right ) <= 0 ) ) { View vr = mChildViews . get ( ( ( mCurrent ) - 1 ) ) ; if ( vr != null ) { slideViewOntoScreen ( vr ) ; return true ; } } break ; case ReaderView . MOVING_DOWN : <START_BUG> if ( ( ReaderView . HORIZONTAL_SCROLLING ) && ( ( bounds . bottom ) <= 0 ) ) { <END_BUG> View vr = mChildViews . get ( ( ( mCurrent ) - 1 ) ) ; if ( vr != null ) { slideViewOntoScreen ( vr ) ; return true ; } } break ; } mScrollerLastX = mScrollerLastY = 0 ; Rect expandedBounds = new Rect ( bounds ) ; expandedBounds . inset ( ( - ( ReaderView . FLING_MARGIN ) ) , ( - ( ReaderView . FLING_MARGIN ) ) ) ; if ( ( ReaderView . withinBoundsInDirectionOfTravel ( bounds , velocityX , velocityY ) ) && ( expandedBounds . contains ( 0 , 0 ) ) ) { mScroller . fling ( 0 , 0 , ( ( int ) ( velocityX ) ) , ( ( int ) ( velocityY ) ) , bounds . left , bounds . right , bounds . top , bounds . bottom ) ; mStepper . prod ( ) ; } } return true ; } public void onLongPress ( MotionEvent e ) { } public boolean onScroll ( MotionEvent e1 , MotionEvent e2 , float distanceX , float distanceY ) { } public void onShowPress ( MotionEvent e ) { } public boolean onSingleTapUp ( MotionEvent e ) { } public boolean onScale ( ScaleGestureDetector detector ) { } public boolean onScaleBegin ( ScaleGestureDetector detector ) { } public void onScaleEnd ( ScaleGestureDetector detector ) { } @ Override public boolean onTouchEvent ( MotionEvent event ) { } @ Override protected void onMeasure ( int widthMeasureSpec , int heightMeasureSpec ) { } @ Override protected void onLayout ( boolean changed , int left , int top , int right , int bottom ) { } @ Override public Adapter getAdapter ( ) { } @ Override public View getSelectedView ( ) { } @ Override public void setAdapter ( Adapter adapter ) { } @ Override public void setSelection ( int arg0 ) { } private View getCached ( ) { } private View getOrCreateChild ( int i ) { } private void addAndMeasureChild ( int i , View v ) { } private void measureView ( View v ) { }

Fix:
if ( ( ! ( ReaderView . HORIZONTAL_SCROLLING ) ) && ( ( bounds . bottom ) <= 0 ) ) {