mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-01 02:12:58 +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;
|
firstShow = false;
|
||||||
loadSpinner();
|
loadSpinner();
|
||||||
showSplashScreen();
|
showSplashScreen(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -115,7 +115,7 @@ public class SplashScreenInternal extends CordovaPlugin {
|
|||||||
if ("hide".equals(data.toString())) {
|
if ("hide".equals(data.toString())) {
|
||||||
this.removeSplashScreen();
|
this.removeSplashScreen();
|
||||||
} else {
|
} else {
|
||||||
this.showSplashScreen();
|
this.showSplashScreen(false);
|
||||||
}
|
}
|
||||||
} else if ("spinner".equals(id)) {
|
} else if ("spinner".equals(id)) {
|
||||||
if ("stop".equals(data.toString())) {
|
if ("stop".equals(data.toString())) {
|
||||||
@ -143,7 +143,7 @@ public class SplashScreenInternal extends CordovaPlugin {
|
|||||||
* Shows the splash screen over the full Activity
|
* Shows the splash screen over the full Activity
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
private void showSplashScreen() {
|
private void showSplashScreen(final boolean hideAfterDelay) {
|
||||||
final int splashscreenTime = preferences.getInteger("SplashScreenDelay", 3000);
|
final int splashscreenTime = preferences.getInteger("SplashScreenDelay", 3000);
|
||||||
final int drawableId = preferences.getInteger("SplashDrawableId", 0);
|
final int drawableId = preferences.getInteger("SplashDrawableId", 0);
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ public class SplashScreenInternal extends CordovaPlugin {
|
|||||||
if (this.splashDialog != null && splashDialog.isShowing()) {
|
if (this.splashDialog != null && splashDialog.isShowing()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (drawableId == 0 || splashscreenTime <= 0) {
|
if (drawableId == 0 || (splashscreenTime <= 0 && hideAfterDelay)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,12 +187,14 @@ public class SplashScreenInternal extends CordovaPlugin {
|
|||||||
splashDialog.show();
|
splashDialog.show();
|
||||||
|
|
||||||
// Set Runnable to remove splash screen just in case
|
// Set Runnable to remove splash screen just in case
|
||||||
final Handler handler = new Handler();
|
if (hideAfterDelay) {
|
||||||
handler.postDelayed(new Runnable() {
|
final Handler handler = new Handler();
|
||||||
public void run() {
|
handler.postDelayed(new Runnable() {
|
||||||
removeSplashScreen();
|
public void run() {
|
||||||
}
|
removeSplashScreen();
|
||||||
}, splashscreenTime);
|
}
|
||||||
|
}, splashscreenTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user