CB-8396 Add AutoHideSplashScreen logic to Android's Splashscreen

Also initializing the splashscreen image irrespective of firstShow because the splashscreen could be shown manually via navigator.splashscreen.show(); after exiting the app using BackButton or via navigator.app.exitApp();
This commit is contained in:
daserge 2016-01-15 11:54:21 +03:00
parent eada9a6ac1
commit 7a12204ba9

View File

@ -73,7 +73,7 @@ public class SplashScreen extends CordovaPlugin {
@Override @Override
protected void pluginInitialize() { protected void pluginInitialize() {
if (HAS_BUILT_IN_SPLASH_SCREEN || !firstShow) { if (HAS_BUILT_IN_SPLASH_SCREEN) {
return; return;
} }
// Make WebView invisible while loading URL // Make WebView invisible while loading URL
@ -93,12 +93,15 @@ public class SplashScreen extends CordovaPlugin {
// Save initial orientation. // Save initial orientation.
orientation = cordova.getActivity().getResources().getConfiguration().orientation; orientation = cordova.getActivity().getResources().getConfiguration().orientation;
if (firstShow) {
boolean autoHide = preferences.getBoolean("AutoHideSplashScreen", true);
loadSpinner();
showSplashScreen(autoHide);
}
if (preferences.getBoolean("SplashShowOnlyFirstTime", true)) { if (preferences.getBoolean("SplashShowOnlyFirstTime", true)) {
firstShow = false; firstShow = false;
} }
loadSpinner();
showSplashScreen(true);
} }
/** /**