cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [3/6] android commit: CB-8280 android: Don't apply SplashScreenDelay when .show() is called explicitly
Date Mon, 19 Jan 2015 21:34:30 GMT
CB-8280 android: Don't apply SplashScreenDelay when .show() is called explicitly


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

Branch: refs/heads/4.0.x
Commit: 34c163be88fcc4cde5de50ab7f71f753f5de1012
Parents: 11002d4
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Mon Jan 19 13:42:11 2015 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Mon Jan 19 13:42:11 2015 -0500

----------------------------------------------------------------------
 .../apache/cordova/SplashScreenInternal.java    | 22 +++++++++++---------
 1 file changed, 12 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/34c163be/framework/src/org/apache/cordova/SplashScreenInternal.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/SplashScreenInternal.java b/framework/src/org/apache/cordova/SplashScreenInternal.java
index 715e418..e1154a5 100644
--- a/framework/src/org/apache/cordova/SplashScreenInternal.java
+++ b/framework/src/org/apache/cordova/SplashScreenInternal.java
@@ -63,7 +63,7 @@ public class SplashScreenInternal extends CordovaPlugin {
 
         firstShow = false;
         loadSpinner();
-        showSplashScreen();
+        showSplashScreen(true);
     }
 
     @Override
@@ -115,7 +115,7 @@ public class SplashScreenInternal extends CordovaPlugin {
             if ("hide".equals(data.toString())) {
                 this.removeSplashScreen();
             } else {
-                this.showSplashScreen();
+                this.showSplashScreen(false);
             }
         } else if ("spinner".equals(id)) {
             if ("stop".equals(data.toString())) {
@@ -143,7 +143,7 @@ public class SplashScreenInternal extends CordovaPlugin {
      * Shows the splash screen over the full Activity
      */
     @SuppressWarnings("deprecation")
-    private void showSplashScreen() {
+    private void showSplashScreen(final boolean hideAfterDelay) {
         final int splashscreenTime = preferences.getInteger("SplashScreenDelay", 3000);
         final int drawableId = preferences.getInteger("SplashDrawableId", 0);
 
@@ -151,7 +151,7 @@ public class SplashScreenInternal extends CordovaPlugin {
         if (this.splashDialog != null && splashDialog.isShowing()) {
             return;
         }
-        if (drawableId == 0 || splashscreenTime <= 0) {
+        if (drawableId == 0 || (splashscreenTime <= 0 && hideAfterDelay)) {
             return;
         }
 
@@ -187,12 +187,14 @@ public class SplashScreenInternal extends CordovaPlugin {
                 splashDialog.show();
 
                 // Set Runnable to remove splash screen just in case
-                final Handler handler = new Handler();
-                handler.postDelayed(new Runnable() {
-                    public void run() {
-                        removeSplashScreen();
-                    }
-                }, splashscreenTime);
+                if (hideAfterDelay) {
+                    final Handler handler = new Handler();
+                    handler.postDelayed(new Runnable() {
+                        public void run() {
+                            removeSplashScreen();
+                        }
+                    }, splashscreenTime);
+                }
             }
         });
     }


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


Mime
View raw message