fragment/src/main/java/androidx/fragment/app/FragmentTransition.java
private static void configureTransitionsReordered(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;

        ArrayList<View> sharedElementsIn = new ArrayList<>();
        ArrayList<View> sharedElementsOut = new ArrayList<>();
        Object enterTransition = getEnterTransition(impl, inFragment, inIsPop);
        Object exitTransition = getExitTransition(impl, outFragment, outIsPop);

        Object sharedElementTransition = configureSharedElementsReordered(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);

        ArrayList<View> enteringViews = configureEnteringExitingViews(impl, enterTransition,
                inFragment, sharedElementsIn, nonExistentView);

        setViewVisibility(enteringViews, View.INVISIBLE);

        Object transition = mergeTransitions(impl, enterTransition, exitTransition,
                sharedElementTransition, inFragment, inIsPop);

        if (transition != null) {
            replaceHide(impl, exitTransition, outFragment, exitingViews);
            ArrayList<String> inNames =
                    impl.prepareSetNameOverridesReordered(sharedElementsIn);
            impl.scheduleRemoveTargets(transition,
                    enterTransition, enteringViews, exitTransition, exitingViews,
                    sharedElementTransition, sharedElementsIn);
            impl.beginDelayedTransition(sceneRoot, transition);
            impl.setNameOverridesReordered(sceneRoot, sharedElementsOut,
                    sharedElementsIn, inNames, nameOverrides);
            setViewVisibility(enteringViews, View.VISIBLE);
            impl.swapSharedElementTargets(sharedElementTransition,
                    sharedElementsOut, sharedElementsIn);
        }
    }
/**
     * Configures a transition for a single fragment container for which the transaction was
     * reordered. That means that all Fragment Views have been added and incoming fragment
     * Views are marked invisible.
     *
     * @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
reordered. That means that all Fragment Views have been added and incoming fragment
Views are marked invisible.

@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 reordered . That means that all Fragment Views have been added and incoming fragment Views are marked invisible . @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 configureTransitionsReordered(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;
        ArrayList<View> sharedElementsIn = new ArrayList<>();
        ArrayList<View> sharedElementsOut = new ArrayList<>();
        Object enterTransition = getEnterTransition(impl, inFragment, inIsPop);
        Object exitTransition = getExitTransition(impl, outFragment, outIsPop);
        Object sharedElementTransition = configureSharedElementsReordered(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);
        ArrayList<View> enteringViews = configureEnteringExitingViews(impl, enterTransition,
                inFragment, sharedElementsIn, nonExistentView);
        setViewVisibility(enteringViews, View.INVISIBLE);
        Object transition = mergeTransitions(impl, enterTransition, exitTransition,
                sharedElementTransition, inFragment, inIsPop);
        if (transition != null) {
            replaceHide(impl, exitTransition, outFragment, exitingViews);
            ArrayList<String> inNames =
                    impl.prepareSetNameOverridesReordered(sharedElementsIn);
            impl.scheduleRemoveTargets(transition,
                    enterTransition, enteringViews, exitTransition, exitingViews,
                    sharedElementTransition, sharedElementsIn);
            impl.beginDelayedTransition(sceneRoot, transition);
            impl.setNameOverridesReordered(sceneRoot, sharedElementsOut,
                    sharedElementsIn, inNames, nameOverrides);
            setViewVisibility(enteringViews, View.VISIBLE);
            impl.swapSharedElementTargets(sharedElementTransition,
                    sharedElementsOut, sharedElementsIn);
        }
    }
private static void configureTransitionsReordered ( 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 ; ArrayList < View > sharedElementsIn = new ArrayList < > ( ) ; ArrayList < View > sharedElementsOut = new ArrayList < > ( ) ; Object enterTransition = getEnterTransition ( impl , inFragment , inIsPop ) ; Object exitTransition = getExitTransition ( impl , outFragment , outIsPop ) ; Object sharedElementTransition = configureSharedElementsReordered ( 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 ) ; ArrayList < View > enteringViews = configureEnteringExitingViews ( impl , enterTransition , inFragment , sharedElementsIn , nonExistentView ) ; setViewVisibility ( enteringViews , View . INVISIBLE ) ; Object transition = mergeTransitions ( impl , enterTransition , exitTransition , sharedElementTransition , inFragment , inIsPop ) ; if ( transition != null ) { replaceHide ( impl , exitTransition , outFragment , exitingViews ) ; ArrayList < String > inNames = impl . prepareSetNameOverridesReordered ( sharedElementsIn ) ; impl . scheduleRemoveTargets ( transition , enterTransition , enteringViews , exitTransition , exitingViews , sharedElementTransition , sharedElementsIn ) ; impl . beginDelayedTransition ( sceneRoot , transition ) ; impl . setNameOverridesReordered ( sceneRoot , sharedElementsOut , sharedElementsIn , inNames , nameOverrides ) ; setViewVisibility ( enteringViews , View . VISIBLE ) ; impl . swapSharedElementTargets ( sharedElementTransition , sharedElementsOut , sharedElementsIn ) ; } }
Configures a transition for a single fragment container for which the transaction was
 reordered.
Configures a transition for a single fragment container for which the transaction was reordered .
// no transitions!