cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dase...@apache.org
Subject [1/2] cordova-plugin-splashscreen git commit: CB-9538 Implementing FadeSplashScreen feature for Android
Date Mon, 11 Jan 2016 10:03:17 GMT
Repository: cordova-plugin-splashscreen
Updated Branches:
  refs/heads/master 3b2e9e591 -> 50318213c


CB-9538 Implementing FadeSplashScreen feature for Android


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/commit/34bc1dbf
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/tree/34bc1dbf
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/diff/34bc1dbf

Branch: refs/heads/master
Commit: 34bc1dbf160f2d3b5b11a86ddb1a992661510587
Parents: 3b2e9e5
Author: Philipp Grosswiler <philipp.grosswiler@ruma.co.id>
Authored: Thu Aug 6 16:29:41 2015 +0700
Committer: daserge <v-seshak@microsoft.com>
Committed: Mon Jan 11 12:44:12 2016 +0300

----------------------------------------------------------------------
 src/android/SplashScreen.java | 39 +++++++++++++++++++++++++++++++++++---
 1 file changed, 36 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/34bc1dbf/src/android/SplashScreen.java
----------------------------------------------------------------------
diff --git a/src/android/SplashScreen.java b/src/android/SplashScreen.java
index 16bc769..aa35b2d 100644
--- a/src/android/SplashScreen.java
+++ b/src/android/SplashScreen.java
@@ -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;
+                    }
                 }
             }
         });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message