Skip to content

Commit cbab54c

Browse files
authored
fix(android): move splash screen trigger before the webview render to prevent flicker (2.x) (#3608)
1 parent 661b63c commit cbab54c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

android/capacitor/src/main/java/com/getcapacitor/Bridge.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ public Bridge(Activity context, WebView webView, List<Class<? extends Plugin>> i
152152
this.config = new CapConfig(getActivity().getAssets(), config);
153153
Logger.init(this.config);
154154

155+
// Display splash screen if configured
156+
if (context instanceof BridgeActivity) {
157+
Splash.showOnLaunch((BridgeActivity) context, this.config);
158+
}
159+
155160
// Initialize web view and message handler for it
156161
this.initWebView();
157162
this.msgHandler = new MessageHandler(this, webView, pluginManager);

android/capacitor/src/main/java/com/getcapacitor/BridgeActivity.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ protected void load(Bundle savedInstanceState) {
8282
cordovaInterface.onCordovaInit(pluginManager);
8383
bridge = new Bridge(this, webView, initialPlugins, cordovaInterface, pluginManager, preferences, this.config);
8484

85-
Splash.showOnLaunch(this, bridge.getConfig());
86-
8785
if (savedInstanceState != null) {
8886
bridge.restoreInstanceState(savedInstanceState);
8987
}

0 commit comments

Comments
 (0)