Skip to content

Commit 40191b9

Browse files
fix(android): only send the updateSystemBars message when the final splash screen has been drawn to prevent a flash between the native and the custom splash screen
1 parent 14749c6 commit 40191b9

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

framework/src/org/apache/cordova/SplashScreenPlugin.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ Licensed to the Apache Software Foundation (ASF) under one
2626
import android.app.Dialog;
2727
import android.app.ProgressDialog;
2828
import android.content.Context;
29-
import android.content.DialogInterface;
3029
import android.content.res.ColorStateList;
3130
import android.content.res.Configuration;
3231
import android.graphics.Color;
@@ -39,6 +38,9 @@ Licensed to the Apache Software Foundation (ASF) under one
3938
import android.view.WindowManager;
4039
import android.view.animation.AccelerateInterpolator;
4140
import android.view.animation.AlphaAnimation;
41+
import android.content.DialogInterface;
42+
import java.util.List;
43+
import java.util.function.Consumer;
4244
import android.view.animation.Animation;
4345
import android.view.animation.DecelerateInterpolator;
4446
import android.widget.ImageView;
@@ -54,8 +56,6 @@ Licensed to the Apache Software Foundation (ASF) under one
5456
import org.json.JSONException;
5557

5658
import java.util.ArrayList;
57-
import java.util.List;
58-
import java.util.function.Consumer;
5959

6060
@SuppressLint("LongLogTag")
6161
public class SplashScreenPlugin extends CordovaPlugin {
@@ -95,6 +95,8 @@ public class SplashScreenPlugin extends CordovaPlugin {
9595
*/
9696
private int fadeDuration;
9797

98+
private static boolean hasCustomSplashscreens;
99+
98100
// Internal variables
99101
/**
100102
* Boolean flag to determine if the splash screen remains visible.
@@ -125,7 +127,7 @@ protected void pluginInitialize() {
125127

126128
Context context = cordova.getContext();
127129
boolean showSpinner = preferences.getBoolean("ShowSplashScreenSpinner", DEFAULT_SHOW_SPINNER);
128-
boolean hasCustomSplashscreens = preferences.getBoolean("HasCustomSplashscreens", DEFAULT_HAS_CUSTOM_SPLASHSCREENS);
130+
hasCustomSplashscreens = preferences.getBoolean("HasCustomSplashscreens", DEFAULT_HAS_CUSTOM_SPLASHSCREENS);
129131
if (!showSpinner && !hasCustomSplashscreens) {
130132
// Use only the Android Splashscreen API
131133
behaviours.registerBehaviour(new AndroidSplashScreenBehaviour(context, autoHide, delayTime, isFadeEnabled, fadeDuration, webView));
@@ -329,7 +331,9 @@ public void onAnimationEnd(Animator animation) {
329331
}
330332
});
331333
} else {
332-
cordovaWebView.getPluginManager().postMessage("updateSystemBars", null);
334+
if(!hasCustomSplashscreens){
335+
cordovaWebView.getPluginManager().postMessage("updateSystemBars", null);
336+
}
333337
}
334338

335339
}

0 commit comments

Comments
 (0)