You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by jc...@apache.org on 2022/10/10 22:25:47 UTC

[cordova-android] 01/01: fix: only do fadeout animation if FadeSplashScreen is true

This is an automated email from the ASF dual-hosted git repository.

jcesarmobile pushed a commit to branch animate-disabled
in repository https://gitbox.apache.org/repos/asf/cordova-android.git

commit bed0f92a5b888d1f8a9cd7e018aaf9989982870d
Author: jcesarmobile <jc...@gmail.com>
AuthorDate: Tue Oct 11 00:25:25 2022 +0200

    fix: only do fadeout animation if FadeSplashScreen is true
---
 .../src/org/apache/cordova/SplashScreenPlugin.java | 44 +++++++++++-----------
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/framework/src/org/apache/cordova/SplashScreenPlugin.java b/framework/src/org/apache/cordova/SplashScreenPlugin.java
index 91bcdc70..425b13f9 100644
--- a/framework/src/org/apache/cordova/SplashScreenPlugin.java
+++ b/framework/src/org/apache/cordova/SplashScreenPlugin.java
@@ -137,27 +137,29 @@ public class SplashScreenPlugin extends CordovaPlugin {
         // 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.
 
-        // 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(isFadeEnabled ? fadeDuration : 0)
-                    .setStartDelay(isFadeEnabled ? 0 : fadeDuration)
-                    .setInterpolator(new AccelerateInterpolator())
-                    .setListener(new AnimatorListenerAdapter() {
-                        @Override
-                        public void onAnimationEnd(Animator animation) {
-                            super.onAnimationEnd(animation);
-                            splashScreenViewProvider.remove();
-                        }
-                    }).start();
-            }
-        });
+        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();
+                }
+            });
+        }
     }
 
     private void attemptCloseOnPageFinished() {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org