private void setupSplashScreen()

in framework/src/org/apache/cordova/SplashScreenPlugin.java [124:163]


    private void setupSplashScreen(SplashScreen splashScreen) {
        // Setup Splash Screen Delay
        splashScreen.setKeepOnScreenCondition(() -> keepOnScreen);

        // auto hide splash screen when custom delay is defined.
        if (autoHide && delayTime != DEFAULT_DELAY_TIME) {
            Handler splashScreenDelayHandler = new Handler(cordova.getContext().getMainLooper());
            splashScreenDelayHandler.postDelayed(() -> keepOnScreen = false, delayTime);
        }

        // auto hide splash screen with default delay (-1) delay is controlled by the
        // `onPageFinished` message.

        // If auto hide is disabled (false), the hiding of the splash screen must be determined &
        // triggered by the front-end code with the `navigator.splashscreen.hide()` method.

        if (isFadeEnabled) {
            // Setup the fade
            splashScreen.setOnExitAnimationListener(new SplashScreen.OnExitAnimationListener() {
                @Override
                public void onSplashScreenExit(@NonNull SplashScreenViewProvider splashScreenViewProvider) {
                    View splashScreenView = splashScreenViewProvider.getView();

                    splashScreenView
                            .animate()
                            .alpha(0.0f)
                            .setDuration(fadeDuration)
                            .setStartDelay(0)
                            .setInterpolator(new AccelerateInterpolator())
                            .setListener(new AnimatorListenerAdapter() {
                                @Override
                                public void onAnimationEnd(Animator animation) {
                                    super.onAnimationEnd(animation);
                                    splashScreenViewProvider.remove();
                                }
                            }).start();
                }
            });
        }
    }