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.View;
|
||||||
import android.view.ViewGroup.LayoutParams;
|
import android.view.ViewGroup.LayoutParams;
|
||||||
import android.view.WindowManager;
|
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.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
@ -196,12 +199,42 @@ public class SplashScreen extends CordovaPlugin {
|
|||||||
private void removeSplashScreen() {
|
private void removeSplashScreen() {
|
||||||
cordova.getActivity().runOnUiThread(new Runnable() {
|
cordova.getActivity().runOnUiThread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (splashDialog != null && splashDialog.isShowing()) {
|
||||||
|
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()) {
|
if (splashDialog != null && splashDialog.isShowing()) {
|
||||||
splashDialog.dismiss();
|
splashDialog.dismiss();
|
||||||
splashDialog = null;
|
splashDialog = null;
|
||||||
splashImageView = 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