private void configureShowAnimator ( @ NonNull final View animatedView , @ NonNull final RectangleRevealAnimation animation , @ NonNull final ViewPropertyAnimator animator ) { int horizontalWindowInset = getDialog ( ) . getWindowInsetLeft ( ) + getDialog ( ) . getWindowInsetRight ( ) ; int verticalWindowInset = getDialog ( ) . getWindowInsetTop ( ) + getDialog ( ) . getWindowInsetBottom ( ) ; float translationX = 0 ; float translationY = 0 ; if ( animation . getX ( ) != null ) { translationX = animation . getX ( ) - animatedView . getLeft ( ) - horizontalWindowInset ; } if ( animation . getY ( ) != null ) { translationY = animation . getY ( ) - animatedView . getTop ( ) - verticalWindowInset ; } if ( animation . getWidth ( ) != null ) { int viewWidth = animatedView . getWidth ( ) - horizontalWindowInset ; translationX -= ( float ) ( viewWidth - animation . getWidth ( ) ) / 2f ; animatedView . setScaleX ( ( float ) animation . getWidth ( ) / ( float ) viewWidth ) ; animator . scaleX ( 1 ) ; } if ( animation . getHeight ( ) != null ) { int viewHeight = animatedView . getHeight ( ) - verticalWindowInset ; translationY -= ( float ) ( viewHeight - animation . getHeight ( ) ) / 2f ; animatedView . setScaleY ( ( float ) animation . getHeight ( ) / ( float ) viewHeight ) ; animator . scaleY ( 1 ) ; } if ( animation . getAlpha ( ) != null ) { animatedView . setAlpha ( animation . getAlpha ( ) ) ; animator . alpha ( 1 ) ; } if ( translationX != 0 ) { animatedView . setTranslationX ( translationX ) ; animator . translationX ( 0 ) ; } if ( translationY != 0 ) { animatedView . setTranslationY ( translationY ) ; animator . translationY ( 0 ) ; } }
Configures an animator which should be used to show the dialog using a rectangular reveal animation .