transition/src/main/java/androidx/transition/Fade.java
private Animator createAnimation(final View view, float startAlpha, float endAlpha) {
        if (startAlpha == endAlpha) {
            return null;
        }
        ViewUtils.setTransitionAlpha(view, startAlpha);
        final ObjectAnimator anim = ObjectAnimator.ofFloat(view, ViewUtils.TRANSITION_ALPHA,
                endAlpha);
        if (DBG) {
            Log.d(LOG_TAG, "Created animator " + anim);
        }
        FadeAnimatorListener listener = new FadeAnimatorListener(view);
        anim.addListener(listener);
        addListener(new TransitionListenerAdapter() {
            @Override
            public void onTransitionEnd(@NonNull Transition transition) {
                ViewUtils.setTransitionAlpha(view, 1);
                ViewUtils.clearNonTransitionAlpha(view);
                transition.removeListener(this);
            }
        });
        return anim;
    }
/**
     * Utility method to handle creating and running the Animator.
     */
Utility method to handle creating and running the Animator.
Utility method to handle creating and running the Animator .
private Animator createAnimation(final View view, float startAlpha, float endAlpha) {
        if (startAlpha == endAlpha) {
            return null;
        }
        ViewUtils.setTransitionAlpha(view, startAlpha);
        final ObjectAnimator anim = ObjectAnimator.ofFloat(view, ViewUtils.TRANSITION_ALPHA,
                endAlpha);
        if (DBG) {
            Log.d(LOG_TAG, "Created animator " + anim);
        }
        FadeAnimatorListener listener = new FadeAnimatorListener(view);
        anim.addListener(listener);
        addListener(new TransitionListenerAdapter() {
            @Override
            public void onTransitionEnd(@NonNull Transition transition) {
                ViewUtils.setTransitionAlpha(view, 1);
                ViewUtils.clearNonTransitionAlpha(view);
                transition.removeListener(this);
            }
        });
        return anim;
    }
private Animator createAnimation ( final View view , float startAlpha , float endAlpha ) { if ( startAlpha == endAlpha ) { return null ; } ViewUtils . setTransitionAlpha ( view , startAlpha ) ; final ObjectAnimator anim = ObjectAnimator . ofFloat ( view , ViewUtils . TRANSITION_ALPHA , endAlpha ) ; if ( DBG ) { Log . d ( LOG_TAG , "Created animator " + anim ) ; } FadeAnimatorListener listener = new FadeAnimatorListener ( view ) ; anim . addListener ( listener ) ; addListener ( new TransitionListenerAdapter ( ) { @ Override public void onTransitionEnd ( @ NonNull Transition transition ) { ViewUtils . setTransitionAlpha ( view , 1 ) ; ViewUtils . clearNonTransitionAlpha ( view ) ; transition . removeListener ( this ) ; } } ) ; return anim ; }
Utility method to handle creating and running the Animator.
Utility method to handle creating and running the Animator .