Skip to content

Commit 2e29b4a

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 2e29b4a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
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 & 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;
@@ -54,8 +53,6 @@ Licensed to the Apache Software Foundation (ASF) under one
5453
import org.json.JSONException;
5554

5655
import java.util.ArrayList;
57-
import java.util.List;
58-
import java.util.function.Consumer;
5956

6057
@SuppressLint("LongLogTag")
6158
public class SplashScreenPlugin extends CordovaPlugin {
@@ -95,6 +92,8 @@ public class SplashScreenPlugin extends CordovaPlugin {
9592
*/
9693
private int fadeDuration;
9794

95+
private static boolean hasCustomSplashscreens;
96+
9897
// Internal variables
9998
/**
10099
* Boolean flag to determine if the splash screen remains visible.
@@ -125,7 +124,7 @@ protected void pluginInitialize() {
125124

126125
Context context = cordova.getContext();
127126
boolean showSpinner = preferences.getBoolean("ShowSplashScreenSpinner", DEFAULT_SHOW_SPINNER);
128-
boolean hasCustomSplashscreens = preferences.getBoolean("HasCustomSplashscreens", DEFAULT_HAS_CUSTOM_SPLASHSCREENS);
127+
hasCustomSplashscreens = preferences.getBoolean("HasCustomSplashscreens", DEFAULT_HAS_CUSTOM_SPLASHSCREENS);
129128
if (!showSpinner && !hasCustomSplashscreens) {
130129
// Use only the Android Splashscreen API
131130
behaviours.registerBehaviour(new AndroidSplashScreenBehaviour(context, autoHide, delayTime, isFadeEnabled, fadeDuration, webView));
@@ -329,7 +328,9 @@ public void onAnimationEnd(Animator animation) {
329328
}
330329
});
331330
} else {
332-
cordovaWebView.getPluginManager().postMessage("updateSystemBars", null);
331+
if(!hasCustomSplashscreens){
332+
cordovaWebView.getPluginManager().postMessage("updateSystemBars", null);
333+
}
333334
}
334335

335336
}

0 commit comments

Comments
 (0)