private long getDuration ( @ NonNull final View animatedView , @ NonNull final DialogAnimation animation ) { double scale = 1 ; if ( animatedView . getAnimation ( ) != null ) { scale = ( double ) ( System . currentTimeMillis ( ) - animatedView . getAnimation ( ) . getStartTime ( ) ) / ( double ) animatedView . getAnimation ( ) . getDuration ( ) ; animatedView . getAnimation ( ) . cancel ( ) ; } return Math . round ( animation . getDuration ( ) * scale ) ; }
Returns the duration which should be used for an animation depending on whether a previous animation is still running or not .