Example #1
0
        @Override
        public void beforeDrawEyes() {
          // splash screen post-init animations
          long currentTime = doMemoryManagementAndPerFrameCallbacks();

          if (mSplashScreen != null && currentTime >= mSplashScreen.mTimeout) {
            if (mSplashScreen.closeRequested() || mScript.getSplashMode() == SplashMode.AUTOMATIC) {

              final SplashScreen splashScreen = mSplashScreen;
              new GVROpacityAnimation(mSplashScreen, mScript.getSplashFadeTime(), 0) //
                  .setOnFinish(
                      new GVROnFinish() {

                        @Override
                        public void finished(GVRAnimation animation) {
                          if (mNextMainScene != null) {
                            setMainScene(mNextMainScene);
                          } else {
                            getMainScene().removeSceneObject(splashScreen);
                          }

                          mFrameHandler = normalFrames;
                          splashFrames = null;
                        }
                      }) //
                  .start(getAnimationEngine());

              mSplashScreen = null;
            }
          }
        }
Example #2
0
        @Override
        public void beforeDrawEyes() {
          mSplashScreen = mScript.createSplashScreen(GVRViewManager.this);
          if (mSplashScreen != null) {
            getMainScene().addSceneObject(mSplashScreen);
          }

          try {
            GVRViewManager.this
                .getEventManager()
                .sendEvent(mScript, IScriptEvents.class, "onInit", GVRViewManager.this);
          } catch (Throwable t) {
            t.printStackTrace();
            mActivity.finish();

            // Just to be safe ...
            mFrameHandler = splashFrames;
            firstFrame = null;

            return;
          }

          if (mSplashScreen == null) {
            mFrameHandler = normalFrames;
            firstFrame = splashFrames = null;
          } else {
            mFrameHandler = splashFrames;
            firstFrame = null;
          }
        }