mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 15:12:51 +08:00
CB-8280 android: Don't apply SplashScreenDelay when .show() is called explicitly
This commit is contained in:
parent
11002d4a56
commit
34c163be88
@ -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,6 +187,7 @@ public class SplashScreenInternal extends CordovaPlugin {
|
||||
splashDialog.show();
|
||||
|
||||
// Set Runnable to remove splash screen just in case
|
||||
if (hideAfterDelay) {
|
||||
final Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
public void run() {
|
||||
@ -194,6 +195,7 @@ public class SplashScreenInternal extends CordovaPlugin {
|
||||
}
|
||||
}, splashscreenTime);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user