private ObjectAnimator createAnimator ( final boolean hide ) { if ( initialPosition == - 1.0f ) { initialPosition = animatedView . getY ( ) ; } float targetPosition = hide ? initialPosition - animatedView . getHeight ( ) : initialPosition ; if ( direction == Direction . DOWN ) { targetPosition = hide ? initialPosition + animatedView . getHeight ( ) : initialPosition ; } ObjectAnimator animation = ObjectAnimator . ofFloat ( animatedView , "y" , animatedView . getY ( ) , targetPosition ) ; animation . setInterpolator ( new AccelerateDecelerateInterpolator ( ) ) ; animation . setDuration ( animationDuration ) ; return animation ; }
Creates and returns an animator which allows to translate the animated view to become shown or hidden .