private static void changeScene(Scene scene, Transition transition) {
   ViewGroup sceneRoot = scene.getSceneRoot();
   Transition transitionClone = null;
   if (transition != null) {
     transitionClone = transition.clone();
     transitionClone.setSceneRoot(sceneRoot);
   }
   Scene oldScene = Scene.getCurrentScene(sceneRoot);
   if (!(oldScene == null || transitionClone == null || !oldScene.isCreatedFromLayoutResource())) {
     transitionClone.setCanRemoveViews(true);
   }
   sceneChangeSetup(sceneRoot, transitionClone);
   scene.enter();
   sceneChangeRunTransition(sceneRoot, transitionClone);
 }
 private Transition getTransition(Scene scene) {
   Transition transition;
   ViewGroup sceneRoot = scene.getSceneRoot();
   if (sceneRoot != null) {
     Scene currScene = Scene.getCurrentScene(sceneRoot);
     if (currScene != null) {
       ArrayMap<Scene, Transition> sceneTransitionMap =
           (ArrayMap) this.mScenePairTransitions.get(scene);
       if (sceneTransitionMap != null) {
         transition = (Transition) sceneTransitionMap.get(currScene);
         if (transition != null) {
           return transition;
         }
       }
     }
   }
   transition = (Transition) this.mSceneTransitions.get(scene);
   return transition != null ? transition : sDefaultTransition;
 }
 /**
  * Returns the Transition for the given scene being entered. The result depends not only on the
  * given scene, but also the scene which the {@link Scene#getSceneRoot() sceneRoot} of the Scene
  * is currently in.
  *
  * @param scene The scene being entered
  * @return The Transition to be used for the given scene change. If no Transition was specified
  *     for this scene change, the default transition will be used instead.
  */
 private Transition getTransition(Scene scene) {
   Transition transition = null;
   ViewGroup sceneRoot = scene.getSceneRoot();
   if (sceneRoot != null) {
     // TODO: cached in Scene instead? long-term, cache in View itself
     Scene currScene = Scene.getCurrentScene(sceneRoot);
     if (currScene != null) {
       ArrayMap<Scene, Transition> sceneTransitionMap = mScenePairTransitions.get(scene);
       if (sceneTransitionMap != null) {
         transition = sceneTransitionMap.get(currScene);
         if (transition != null) {
           return transition;
         }
       }
     }
   }
   transition = mSceneTransitions.get(scene);
   return (transition != null) ? transition : sDefaultTransition;
 }