CB-8280 android: Don't apply SplashScreenDelay when .show() is called explicitly

This commit is contained in:
Andrew Grieve 2015-01-19 13:42:11 -05:00
parent 11002d4a56
commit 34c163be88

View File

@ -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);
}
}
});
}