CB-9538 Implementing FadeSplashScreen feature for Android
This commit is contained in:
parent
3b2e9e5912
commit
34bc1dbf16
@ -30,6 +30,9 @@ import android.view.Display;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AlphaAnimation;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
@ -197,9 +200,39 @@ public class SplashScreen extends CordovaPlugin {
|
||||
cordova.getActivity().runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
if (splashDialog != null && splashDialog.isShowing()) {
|
||||
splashDialog.dismiss();
|
||||
splashDialog = null;
|
||||
splashImageView = null;
|
||||
if (preferences.getBoolean("FadeSplashScreen", true)) {
|
||||
final int splashscreenDuration = (int)(preferences.getDouble("FadeSplashScreenDuration", 2) * 1000);
|
||||
|
||||
AlphaAnimation fadeOut = new AlphaAnimation(1, 0);
|
||||
fadeOut.setInterpolator(new DecelerateInterpolator()); //add this
|
||||
fadeOut.setDuration(splashscreenDuration);
|
||||
|
||||
splashImageView.setAnimation(fadeOut);
|
||||
splashImageView.startAnimation(fadeOut);
|
||||
|
||||
fadeOut.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
if (splashDialog != null && splashDialog.isShowing()) {
|
||||
splashDialog.dismiss();
|
||||
splashDialog = null;
|
||||
splashImageView = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
splashDialog.dismiss();
|
||||
splashDialog = null;
|
||||
splashImageView = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user