mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-31 17:32:51 +08:00
fix: only do fadeout animation if FadeSplashScreen is true (#1506)
This commit is contained in:
parent
80f232aa79
commit
56d4b8312b
@ -137,27 +137,29 @@ public class SplashScreenPlugin extends CordovaPlugin {
|
|||||||
// If auto hide is disabled (false), the hiding of the splash screen must be determined &
|
// If auto hide is disabled (false), the hiding of the splash screen must be determined &
|
||||||
// triggered by the front-end code with the `navigator.splashscreen.hide()` method.
|
// triggered by the front-end code with the `navigator.splashscreen.hide()` method.
|
||||||
|
|
||||||
// Setup the fade
|
if (isFadeEnabled) {
|
||||||
splashScreen.setOnExitAnimationListener(new SplashScreen.OnExitAnimationListener() {
|
// Setup the fade
|
||||||
@Override
|
splashScreen.setOnExitAnimationListener(new SplashScreen.OnExitAnimationListener() {
|
||||||
public void onSplashScreenExit(@NonNull SplashScreenViewProvider splashScreenViewProvider) {
|
@Override
|
||||||
View splashScreenView = splashScreenViewProvider.getView();
|
public void onSplashScreenExit(@NonNull SplashScreenViewProvider splashScreenViewProvider) {
|
||||||
|
View splashScreenView = splashScreenViewProvider.getView();
|
||||||
|
|
||||||
splashScreenView
|
splashScreenView
|
||||||
.animate()
|
.animate()
|
||||||
.alpha(0.0f)
|
.alpha(0.0f)
|
||||||
.setDuration(isFadeEnabled ? fadeDuration : 0)
|
.setDuration(fadeDuration)
|
||||||
.setStartDelay(isFadeEnabled ? 0 : fadeDuration)
|
.setStartDelay(0)
|
||||||
.setInterpolator(new AccelerateInterpolator())
|
.setInterpolator(new AccelerateInterpolator())
|
||||||
.setListener(new AnimatorListenerAdapter() {
|
.setListener(new AnimatorListenerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
super.onAnimationEnd(animation);
|
super.onAnimationEnd(animation);
|
||||||
splashScreenViewProvider.remove();
|
splashScreenViewProvider.remove();
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void attemptCloseOnPageFinished() {
|
private void attemptCloseOnPageFinished() {
|
||||||
|
Loading…
Reference in New Issue
Block a user