Skip to content

Commit 0836c11

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 0836c11

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public void run() {
253253
*/
254254
public void overrideBackbutton(boolean override) {
255255
LOG.i("App", "WARNING: Back Button Default Behavior will be overridden. The backbutton event will be fired!");
256-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA) {
256+
if (Build.VERSION.SDK_INT >= 36) { // Build.VERSION_CODES.BAKLAVA
257257
if (override) {
258258
synchronized (backButtonHandlerLock) {
259259
if (backCallback == null) {

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ Licensed to the Apache Software Foundation (ASF) under one
5454
import org.json.JSONException;
5555

5656
import java.util.ArrayList;
57-
import java.util.List;
58-
import java.util.function.Consumer;
5957

6058
@SuppressLint("LongLogTag")
6159
public class SplashScreenPlugin extends CordovaPlugin {
@@ -95,6 +93,8 @@ public class SplashScreenPlugin extends CordovaPlugin {
9593
*/
9694
private int fadeDuration;
9795

96+
private static boolean hasCustomSplashscreens;
97+
9898
// Internal variables
9999
/**
100100
* Boolean flag to determine if the splash screen remains visible.
@@ -125,7 +125,7 @@ protected void pluginInitialize() {
125125

126126
Context context = cordova.getContext();
127127
boolean showSpinner = preferences.getBoolean("ShowSplashScreenSpinner", DEFAULT_SHOW_SPINNER);
128-
boolean hasCustomSplashscreens = preferences.getBoolean("HasCustomSplashscreens", DEFAULT_HAS_CUSTOM_SPLASHSCREENS);
128+
hasCustomSplashscreens = preferences.getBoolean("HasCustomSplashscreens", DEFAULT_HAS_CUSTOM_SPLASHSCREENS);
129129
if (!showSpinner && !hasCustomSplashscreens) {
130130
// Use only the Android Splashscreen API
131131
behaviours.registerBehaviour(new AndroidSplashScreenBehaviour(context, autoHide, delayTime, isFadeEnabled, fadeDuration, webView));
@@ -329,7 +329,9 @@ public void onAnimationEnd(Animator animation) {
329329
}
330330
});
331331
} else {
332-
cordovaWebView.getPluginManager().postMessage("updateSystemBars", null);
332+
if(!hasCustomSplashscreens){
333+
cordovaWebView.getPluginManager().postMessage("updateSystemBars", null);
334+
}
333335
}
334336

335337
}

0 commit comments

Comments
 (0)