private boolean tryToMove ( float deltaY ) { // has reached the bottom if ( ( deltaY > 0 && mCurrentPos == 0 ) ) { if ( DEBUG ) { Log . d ( LOG_TAG , String . format ( "has reached the bottom" ) ) ; } return false ; } // has reached the top if ( ( deltaY < 0 && mCurrentPos == - mHeaderHeight ) ) { if ( DEBUG ) { Log . d ( LOG_TAG , String . format ( "has reached the top" ) ) ; } return false ; } int to = mCurrentPos + ( int ) deltaY ; // over top if ( to < - mHeaderHeight ) { if ( DEBUG ) { Log . d ( LOG_TAG , String . format ( "over top" ) ) ; } to = - mHeaderHeight ; } // over bottom if ( to > 0 ) { if ( DEBUG ) { Log . d ( LOG_TAG , String . format ( "over bottom" ) ) ; } to = 0 ; } return moveTo ( to ) ; }
if deltaY > 0 tryToMove the content down