fragment/src/main/java/androidx/fragment/app/FragmentManager.java
private void endAnimatingAwayFragments() {
        final int numFragments = mActive == null ? 0 : mActive.size();
        for (int i = 0; i < numFragments; i++) {
            Fragment fragment = mActive.valueAt(i);
            if (fragment != null) {
                if (fragment.getAnimatingAway() != null) {
                    // Give up waiting for the animation and just end it.
                    final int stateAfterAnimating = fragment.getStateAfterAnimating();
                    final View animatingAway = fragment.getAnimatingAway();
                    Animation animation = animatingAway.getAnimation();
                    if (animation != null) {
                        animation.cancel();
                        // force-clear the animation, as Animation#cancel() doesn't work prior to N,
                        // and will instead cause the animation to infinitely loop
                        animatingAway.clearAnimation();
                    }
                    fragment.setAnimatingAway(null);
                    moveToState(fragment, stateAfterAnimating, 0, 0, false);
                } else if (fragment.getAnimator() != null) {
                    fragment.getAnimator().end();
                }
            }
        }
    }
/**
     * Ends the animations of fragments so that they immediately reach the end state.
     * This is used prior to saving the state so that the correct state is saved.
     */
Ends the animations of fragments so that they immediately reach the end state.
This is used prior to saving the state so that the correct state is saved.
Ends the animations of fragments so that they immediately reach the end state . This is used prior to saving the state so that the correct state is saved .
private void endAnimatingAwayFragments() {
        final int numFragments = mActive == null ? 0 : mActive.size();
        for (int i = 0; i < numFragments; i++) {
            Fragment fragment = mActive.valueAt(i);
            if (fragment != null) {
                if (fragment.getAnimatingAway() != null) {
                    final int stateAfterAnimating = fragment.getStateAfterAnimating();
                    final View animatingAway = fragment.getAnimatingAway();
                    Animation animation = animatingAway.getAnimation();
                    if (animation != null) {
                        animation.cancel();
                        animatingAway.clearAnimation();
                    }
                    fragment.setAnimatingAway(null);
                    moveToState(fragment, stateAfterAnimating, 0, 0, false);
                } else if (fragment.getAnimator() != null) {
                    fragment.getAnimator().end();
                }
            }
        }
    }
private void endAnimatingAwayFragments ( ) { final int numFragments = mActive == null ? 0 : mActive . size ( ) ; for ( int i = 0 ; i < numFragments ; i ++ ) { Fragment fragment = mActive . valueAt ( i ) ; if ( fragment != null ) { if ( fragment . getAnimatingAway ( ) != null ) { final int stateAfterAnimating = fragment . getStateAfterAnimating ( ) ; final View animatingAway = fragment . getAnimatingAway ( ) ; Animation animation = animatingAway . getAnimation ( ) ; if ( animation != null ) { animation . cancel ( ) ; animatingAway . clearAnimation ( ) ; } fragment . setAnimatingAway ( null ) ; moveToState ( fragment , stateAfterAnimating , 0 , 0 , false ) ; } else if ( fragment . getAnimator ( ) != null ) { fragment . getAnimator ( ) . end ( ) ; } } } }
Ends the animations of fragments so that they immediately reach the end state.
Ends the animations of fragments so that they immediately reach the end state .
// Give up waiting for the animation and just end it. // force-clear the animation, as Animation#cancel() doesn't work prior to N, // and will instead cause the animation to infinitely loop