diff --git a/framework/src/org/apache/cordova/SplashScreenInternal.java b/framework/src/org/apache/cordova/SplashScreenInternal.java index 715e4182..e1154a53 100644 --- a/framework/src/org/apache/cordova/SplashScreenInternal.java +++ b/framework/src/org/apache/cordova/SplashScreenInternal.java @@ -63,7 +63,7 @@ public class SplashScreenInternal extends CordovaPlugin { firstShow = false; loadSpinner(); - showSplashScreen(); + showSplashScreen(true); } @Override @@ -115,7 +115,7 @@ public class SplashScreenInternal extends CordovaPlugin { if ("hide".equals(data.toString())) { this.removeSplashScreen(); } else { - this.showSplashScreen(); + this.showSplashScreen(false); } } else if ("spinner".equals(id)) { if ("stop".equals(data.toString())) { @@ -143,7 +143,7 @@ public class SplashScreenInternal extends CordovaPlugin { * Shows the splash screen over the full Activity */ @SuppressWarnings("deprecation") - private void showSplashScreen() { + private void showSplashScreen(final boolean hideAfterDelay) { final int splashscreenTime = preferences.getInteger("SplashScreenDelay", 3000); final int drawableId = preferences.getInteger("SplashDrawableId", 0); @@ -151,7 +151,7 @@ public class SplashScreenInternal extends CordovaPlugin { if (this.splashDialog != null && splashDialog.isShowing()) { return; } - if (drawableId == 0 || splashscreenTime <= 0) { + if (drawableId == 0 || (splashscreenTime <= 0 && hideAfterDelay)) { return; } @@ -187,12 +187,14 @@ public class SplashScreenInternal extends CordovaPlugin { splashDialog.show(); // Set Runnable to remove splash screen just in case - final Handler handler = new Handler(); - handler.postDelayed(new Runnable() { - public void run() { - removeSplashScreen(); - } - }, splashscreenTime); + if (hideAfterDelay) { + final Handler handler = new Handler(); + handler.postDelayed(new Runnable() { + public void run() { + removeSplashScreen(); + } + }, splashscreenTime); + } } }); }