Skip to content

Commit aa932ff

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 aa932ff

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 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;
@@ -36,7 +35,6 @@ Licensed to the Apache Software Foundation (ASF) under one
3635
import android.view.Gravity;
3736
import android.view.View;
3837
import android.view.ViewGroup.LayoutParams;
39-
import android.view.WindowManager;
4038
import android.view.animation.AccelerateInterpolator;
4139
import android.view.animation.AlphaAnimation;
4240
import android.view.animation.Animation;
@@ -54,8 +52,6 @@ Licensed to the Apache Software Foundation (ASF) under one
5452
import org.json.JSONException;
5553

5654
import java.util.ArrayList;
57-
import java.util.List;
58-
import java.util.function.Consumer;
5955

6056
@SuppressLint("LongLogTag")
6157
public class SplashScreenPlugin extends CordovaPlugin {
@@ -95,6 +91,8 @@ public class SplashScreenPlugin extends CordovaPlugin {
9591
*/
9692
private int fadeDuration;
9793

94+
private static boolean hasCustomSplashscreens;
95+
9896
// Internal variables
9997
/**
10098
* Boolean flag to determine if the splash screen remains visible.
@@ -125,7 +123,7 @@ protected void pluginInitialize() {
125123

126124
Context context = cordova.getContext();
127125
boolean showSpinner = preferences.getBoolean("ShowSplashScreenSpinner", DEFAULT_SHOW_SPINNER);
128-
boolean hasCustomSplashscreens = preferences.getBoolean("HasCustomSplashscreens", DEFAULT_HAS_CUSTOM_SPLASHSCREENS);
126+
hasCustomSplashscreens = preferences.getBoolean("HasCustomSplashscreens", DEFAULT_HAS_CUSTOM_SPLASHSCREENS);
129127
if (!showSpinner && !hasCustomSplashscreens) {
130128
// Use only the Android Splashscreen API
131129
behaviours.registerBehaviour(new AndroidSplashScreenBehaviour(context, autoHide, delayTime, isFadeEnabled, fadeDuration, webView));
@@ -329,7 +327,9 @@ public void onAnimationEnd(Animator animation) {
329327
}
330328
});
331329
} else {
332-
cordovaWebView.getPluginManager().postMessage("updateSystemBars", null);
330+
if(!hasCustomSplashscreens){
331+
cordovaWebView.getPluginManager().postMessage("updateSystemBars", null);
332+
}
333333
}
334334

335335
}

0 commit comments

Comments
 (0)