cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dase...@apache.org
Subject [2/2] cordova-plugin-splashscreen git commit: CB-11156 Change default FadeSplashScreenDuration value
Date Thu, 12 May 2016 12:07:13 GMT
CB-11156 Change default FadeSplashScreenDuration value


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/4adff6f1
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/tree/4adff6f1
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/diff/4adff6f1

Branch: refs/heads/master
Commit: 4adff6f1c9c11e4d2230f9db44320d09c28836fa
Parents: 3d924fc
Author: daserge <v-seshak@microsoft.com>
Authored: Wed Apr 27 11:55:31 2016 +0300
Committer: daserge <v-seshak@microsoft.com>
Committed: Thu May 12 15:00:00 2016 +0300

----------------------------------------------------------------------
 README.md                     | 25 +++++++++++++------------
 src/android/SplashScreen.java |  3 ++-
 src/ios/CDVSplashScreen.m     |  3 ++-
 3 files changed, 17 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/4adff6f1/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 79ac425..fc1993a 100644
--- a/README.md
+++ b/README.md
@@ -129,6 +129,8 @@ projectRoot
     <preference name="SplashScreenDelay" value="3000" />
 ```
 
+Note also that this value used to be seconds, and not milliseconds, so values less than 30
will still be treated as seconds. ( Consider this a deprecated patch that will disapear in
some future version. )
+
 - `FadeSplashScreen` (boolean, defaults to `true`): Set to `false` to
   prevent the splash screen from fading in and out when its display
   state changes.
@@ -137,15 +139,13 @@ projectRoot
     <preference name="FadeSplashScreen" value="false"/>
 ```
 
-- `FadeSplashScreenDuration` (float, defaults to `3000`): Specifies the
+- `FadeSplashScreenDuration` (float, defaults to `500`): Specifies the
   number of milliseconds for the splash screen fade effect to execute.
 
 ```xml
-    <preference name="FadeSplashScreenDuration" value="3000"/>
+    <preference name="FadeSplashScreenDuration" value="750"/>
 ```
 
-Note also that this value used to be seconds, and not milliseconds, so values less than 30
will still be treated as seconds. ( Consider this a deprecated patch that will disapear in
some future version. )
-
 _Note_: `FadeSplashScreenDuration` is included into `SplashScreenDelay`, for example if you
have `<preference name="SplashScreenDelay" value="3000" />` and `<preference name="FadeSplashScreenDuration"
value="1000"/>` defined in `config.xml`:
 
 - 00:00 - splashscreen is shown
@@ -172,16 +172,13 @@ window.setTimeout(function () {
 
 ### Android Quirks
 
-In your `config.xml`, you need to add the following preferences:
+In your `config.xml`, you can add the following preferences:
 
 ```xml
-<preference name="SplashScreenDelay" value="3000" />
 <preference name="SplashMaintainAspectRatio" value="true|false" />
 <preference name="SplashShowOnlyFirstTime" value="true|false" />
 ```
 
-The first parameter represents how long the splashscreen will appear in milliseconds. It
defaults to 3000 ms.
-
 "SplashMaintainAspectRatio" preference is optional. If set to true, splash screen drawable
is not stretched to fit screen, but instead simply "covers" the screen, like CSS "background-size:cover".
This is very useful when splash screen images cannot be distorted in any way, for example
when they contain scenery or text. This setting works best with images that have large margins
(safe areas) that can be safely cropped on screens with different aspect ratios.
 
 The plugin reloads splash drawable whenever orientation changes, so you can specify different
drawables for portrait and landscape orientations.
@@ -213,13 +210,17 @@ __Note__: `SplashScreen` value should be absolute in order to work in
a sub-page
 
 - `SplashScreenSpinnerColor` (string, defaults to system accent color): hash, rgb notation
or CSS color name.
 
-        <preference name="SplashScreenSpinnerColor" value="#242424"/>
-        <preference name="SplashScreenSpinnerColor" value="DarkRed"/>
-        <preference name="SplashScreenSpinnerColor" value="rgb(50,128,128)"/>
+```xml
+<preference name="SplashScreenSpinnerColor" value="#242424"/>
+<preference name="SplashScreenSpinnerColor" value="DarkRed"/>
+<preference name="SplashScreenSpinnerColor" value="rgb(50,128,128)"/>
+```
 
 - `SplashScreenBackgroundColor` (string, defaults to #464646): hex notation.
 
-        <preference name="SplashScreenBackgroundColor" value="0xFFFFFFFF"/>
+```xml
+<preference name="SplashScreenBackgroundColor" value="0xFFFFFFFF"/>
+```
 
 
 ## Methods

http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/4adff6f1/src/android/SplashScreen.java
----------------------------------------------------------------------
diff --git a/src/android/SplashScreen.java b/src/android/SplashScreen.java
index d9ac66a..7f5cedc 100644
--- a/src/android/SplashScreen.java
+++ b/src/android/SplashScreen.java
@@ -52,6 +52,7 @@ public class SplashScreen extends CordovaPlugin {
     // Enable functionality only if running on 4.x.x.
     private static final boolean HAS_BUILT_IN_SPLASH_SCREEN = Integer.valueOf(CordovaWebView.CORDOVA_VERSION.split("\\.")[0])
< 4;
     private static final int DEFAULT_SPLASHSCREEN_DURATION = 3000;
+    private static final int DEFAULT_FADE_DURATION = 500;
     private static Dialog splashDialog;
     private static ProgressDialog spinnerDialog;
     private static boolean firstShow = true;
@@ -117,7 +118,7 @@ public class SplashScreen extends CordovaPlugin {
 
     private int getFadeDuration () {
         int fadeSplashScreenDuration = preferences.getBoolean("FadeSplashScreen", true) ?
-            preferences.getInteger("FadeSplashScreenDuration", DEFAULT_SPLASHSCREEN_DURATION)
: 0;
+            preferences.getInteger("FadeSplashScreenDuration", DEFAULT_FADE_DURATION) : 0;
 
         if (fadeSplashScreenDuration < 30) {
             // [CB-9750] This value used to be in decimal seconds, so we will assume that
if someone specifies 10

http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/4adff6f1/src/ios/CDVSplashScreen.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVSplashScreen.m b/src/ios/CDVSplashScreen.m
index 1d7b955..448a23f 100644
--- a/src/ios/CDVSplashScreen.m
+++ b/src/ios/CDVSplashScreen.m
@@ -23,6 +23,7 @@
 #import "CDVViewController+SplashScreen.h"
 
 #define kSplashScreenDurationDefault 3000.0f
+#define kFadeDurationDefault 500.0f
 
 
 @implementation CDVSplashScreen
@@ -390,7 +391,7 @@
         id fadeSplashScreenValue = [self.commandDelegate.settings objectForKey:[@"FadeSplashScreen"
lowercaseString]];
         id fadeSplashScreenDuration = [self.commandDelegate.settings objectForKey:[@"FadeSplashScreenDuration"
lowercaseString]];
 
-        float fadeDuration = fadeSplashScreenDuration == nil ? kSplashScreenDurationDefault
: [fadeSplashScreenDuration floatValue];
+        float fadeDuration = fadeSplashScreenDuration == nil ? kFadeDurationDefault : [fadeSplashScreenDuration
floatValue];
 
         id splashDurationString = [self.commandDelegate.settings objectForKey: [@"SplashScreenDelay"
lowercaseString]];
         float splashDuration = splashDurationString == nil ? kSplashScreenDurationDefault
: [splashDurationString floatValue];


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


Mime
View raw message