fragment/src/main/java/androidx/fragment/app/FragmentTransition.java
private static void configureTransitionsOrdered(FragmentManagerImpl fragmentManager,
            int containerId, FragmentContainerTransition fragments,
            View nonExistentView, ArrayMap<String, String> nameOverrides) {
        ViewGroup sceneRoot = null;
        if (fragmentManager.mContainer.onHasView()) {
            sceneRoot = (ViewGroup) fragmentManager.mContainer.onFindViewById(containerId);
        }
        if (sceneRoot == null) {
            return;
        }
        final Fragment inFragment = fragments.lastIn;
        final Fragment outFragment = fragments.firstOut;
        final FragmentTransitionImpl impl = chooseImpl(outFragment, inFragment);
        if (impl == null) {
            return;
        }
        final boolean inIsPop = fragments.lastInIsPop;
        final boolean outIsPop = fragments.firstOutIsPop;

        Object enterTransition = getEnterTransition(impl, inFragment, inIsPop);
        Object exitTransition = getExitTransition(impl, outFragment, outIsPop);

        ArrayList<View> sharedElementsOut = new ArrayList<>();
        ArrayList<View> sharedElementsIn = new ArrayList<>();

        Object sharedElementTransition = configureSharedElementsOrdered(impl, sceneRoot,
                nonExistentView, nameOverrides, fragments, sharedElementsOut, sharedElementsIn,
                enterTransition, exitTransition);

        if (enterTransition == null && sharedElementTransition == null
                && exitTransition == null) {
            return; // no transitions!
        }

        ArrayList<View> exitingViews = configureEnteringExitingViews(impl, exitTransition,
                outFragment, sharedElementsOut, nonExistentView);

        if (exitingViews == null || exitingViews.isEmpty()) {
            exitTransition = null;
        }

        // Ensure the entering transition doesn't target anything until the views are made
        // visible
        impl.addTarget(enterTransition, nonExistentView);

        Object transition = mergeTransitions(impl, enterTransition, exitTransition,
                sharedElementTransition, inFragment, fragments.lastInIsPop);

        if (transition != null) {
            final ArrayList<View> enteringViews = new ArrayList<>();
            impl.scheduleRemoveTargets(transition,
                    enterTransition, enteringViews, exitTransition, exitingViews,
                    sharedElementTransition, sharedElementsIn);
            scheduleTargetChange(impl, sceneRoot, inFragment, nonExistentView, sharedElementsIn,
                    enterTransition, enteringViews, exitTransition, exitingViews);
            impl.setNameOverridesOrdered(sceneRoot, sharedElementsIn, nameOverrides);

            impl.beginDelayedTransition(sceneRoot, transition);
            impl.scheduleNameReset(sceneRoot, sharedElementsIn, nameOverrides);
        }
    }
/**
     * Configures a transition for a single fragment container for which the transaction was
     * ordered. That means that the transaction has not been executed yet, so incoming
     * Views are not yet known.
     *
     * @param fragmentManager The executing FragmentManagerImpl
     * @param containerId The container ID that is executing the transition.
     * @param fragments A structure holding the transitioning fragments in this container.
     * @param nonExistentView A View that does not exist in the hierarchy. This is used to
     *                        prevent transitions from acting on other Views when there is no
     *                        other target.
     * @param nameOverrides A map of the shared element names from the starting fragment to
     *                      the final fragment's Views as given in
     *                      {@link FragmentTransaction#addSharedElement(View, String)}.
     */
Configures a transition for a single fragment container for which the transaction was
ordered. That means that the transaction has not been executed yet, so incoming
Views are not yet known.

@param fragmentManager The executing FragmentManagerImpl
@param containerId The container ID that is executing the transition.
@param fragments A structure holding the transitioning fragments in this container.
@param nonExistentView A View that does not exist in the hierarchy. This is used to
prevent transitions from acting on other Views when there is no
other target.
@param nameOverrides A map of the shared element names from the starting fragment to
the final fragment's Views as given in
FragmentTransaction#addSharedElement(View, String).
Configures a transition for a single fragment container for which the transaction was ordered . That means that the transaction has not been executed yet so incoming Views are not yet known . @param fragmentManager The executing FragmentManagerImpl @param containerId The container ID that is executing the transition . @param fragments A structure holding the transitioning fragments in this container . @param nonExistentView A View that does not exist in the hierarchy . This is used to prevent transitions from acting on other Views when there is no other target . @param nameOverrides A map of the shared element names from the starting fragment to the final fragment ' s Views as given in FragmentTransaction#addSharedElement ( View String ) .
private static void configureTransitionsOrdered(FragmentManagerImpl fragmentManager,
            int containerId, FragmentContainerTransition fragments,
            View nonExistentView, ArrayMap<String, String> nameOverrides) {
        ViewGroup sceneRoot = null;
        if (fragmentManager.mContainer.onHasView()) {
            sceneRoot = (ViewGroup) fragmentManager.mContainer.onFindViewById(containerId);
        }
        if (sceneRoot == null) {
            return;
        }
        final Fragment inFragment = fragments.lastIn;
        final Fragment outFragment = fragments.firstOut;
        final FragmentTransitionImpl impl = chooseImpl(outFragment, inFragment);
        if (impl == null) {
            return;
        }
        final boolean inIsPop = fragments.lastInIsPop;
        final boolean outIsPop = fragments.firstOutIsPop;
        Object enterTransition = getEnterTransition(impl, inFragment, inIsPop);
        Object exitTransition = getExitTransition(impl, outFragment, outIsPop);
        ArrayList<View> sharedElementsOut = new ArrayList<>();
        ArrayList<View> sharedElementsIn = new ArrayList<>();
        Object sharedElementTransition = configureSharedElementsOrdered(impl, sceneRoot,
                nonExistentView, nameOverrides, fragments, sharedElementsOut, sharedElementsIn,
                enterTransition, exitTransition);
        if (enterTransition == null && sharedElementTransition == null
                && exitTransition == null) {
            return; 
        }
        ArrayList<View> exitingViews = configureEnteringExitingViews(impl, exitTransition,
                outFragment, sharedElementsOut, nonExistentView);
        if (exitingViews == null || exitingViews.isEmpty()) {
            exitTransition = null;
        }
        impl.addTarget(enterTransition, nonExistentView);
        Object transition = mergeTransitions(impl, enterTransition, exitTransition,
                sharedElementTransition, inFragment, fragments.lastInIsPop);
        if (transition != null) {
            final ArrayList<View> enteringViews = new ArrayList<>();
            impl.scheduleRemoveTargets(transition,
                    enterTransition, enteringViews, exitTransition, exitingViews,
                    sharedElementTransition, sharedElementsIn);
            scheduleTargetChange(impl, sceneRoot, inFragment, nonExistentView, sharedElementsIn,
                    enterTransition, enteringViews, exitTransition, exitingViews);
            impl.setNameOverridesOrdered(sceneRoot, sharedElementsIn, nameOverrides);
            impl.beginDelayedTransition(sceneRoot, transition);
            impl.scheduleNameReset(sceneRoot, sharedElementsIn, nameOverrides);
        }
    }
private static void configureTransitionsOrdered ( FragmentManagerImpl fragmentManager , int containerId , FragmentContainerTransition fragments , View nonExistentView , ArrayMap < String , String > nameOverrides ) { ViewGroup sceneRoot = null ; if ( fragmentManager . mContainer . onHasView ( ) ) { sceneRoot = ( ViewGroup ) fragmentManager . mContainer . onFindViewById ( containerId ) ; } if ( sceneRoot == null ) { return ; } final Fragment inFragment = fragments . lastIn ; final Fragment outFragment = fragments . firstOut ; final FragmentTransitionImpl impl = chooseImpl ( outFragment , inFragment ) ; if ( impl == null ) { return ; } final boolean inIsPop = fragments . lastInIsPop ; final boolean outIsPop = fragments . firstOutIsPop ; Object enterTransition = getEnterTransition ( impl , inFragment , inIsPop ) ; Object exitTransition = getExitTransition ( impl , outFragment , outIsPop ) ; ArrayList < View > sharedElementsOut = new ArrayList < > ( ) ; ArrayList < View > sharedElementsIn = new ArrayList < > ( ) ; Object sharedElementTransition = configureSharedElementsOrdered ( impl , sceneRoot , nonExistentView , nameOverrides , fragments , sharedElementsOut , sharedElementsIn , enterTransition , exitTransition ) ; if ( enterTransition == null && sharedElementTransition == null && exitTransition == null ) { return ; } ArrayList < View > exitingViews = configureEnteringExitingViews ( impl , exitTransition , outFragment , sharedElementsOut , nonExistentView ) ; if ( exitingViews == null || exitingViews . isEmpty ( ) ) { exitTransition = null ; } impl . addTarget ( enterTransition , nonExistentView ) ; Object transition = mergeTransitions ( impl , enterTransition , exitTransition , sharedElementTransition , inFragment , fragments . lastInIsPop ) ; if ( transition != null ) { final ArrayList < View > enteringViews = new ArrayList < > ( ) ; impl . scheduleRemoveTargets ( transition , enterTransition , enteringViews , exitTransition , exitingViews , sharedElementTransition , sharedElementsIn ) ; scheduleTargetChange ( impl , sceneRoot , inFragment , nonExistentView , sharedElementsIn , enterTransition , enteringViews , exitTransition , exitingViews ) ; impl . setNameOverridesOrdered ( sceneRoot , sharedElementsIn , nameOverrides ) ; impl . beginDelayedTransition ( sceneRoot , transition ) ; impl . scheduleNameReset ( sceneRoot , sharedElementsIn , nameOverrides ) ; } }
Configures a transition for a single fragment container for which the transaction was
 ordered.
Configures a transition for a single fragment container for which the transaction was ordered .
// no transitions! // Ensure the entering transition doesn't target anything until the views are made // visible