You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by da...@apache.org on 2015/12/26 21:06:08 UTC

cordova-plugin-splashscreen git commit: CB-9374 Android: add SplashShowOnlyFirstTime as preference

Repository: cordova-plugin-splashscreen
Updated Branches:
  refs/heads/master fa3b66522 -> 1e67606c6


CB-9374 Android: add SplashShowOnlyFirstTime as preference

Github: close #70


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

Branch: refs/heads/master
Commit: 1e67606c60287f787f2caa80ac6cc6c4a64805be
Parents: fa3b665
Author: Wilson Pinto <wi...@gmail.com>
Authored: Sat Dec 26 18:36:37 2015 +0000
Committer: daserge <v-...@microsoft.com>
Committed: Sat Dec 26 23:01:15 2015 +0300

----------------------------------------------------------------------
 README.md                     | 3 +++
 src/android/SplashScreen.java | 5 ++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/1e67606c/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index ff790b1..63ee109 100644
--- a/README.md
+++ b/README.md
@@ -66,6 +66,7 @@ In your `config.xml`, you need to add the following preferences:
     <preference name="SplashScreen" value="foo" />
     <preference name="SplashScreenDelay" value="3000" />
     <preference name="SplashMaintainAspectRatio" value="true|false" />
+    <preference name="SplashShowOnlyFirstTime" value="true|false" />
 
 Where foo is the name of the splashscreen file, preferably a 9 patch file. Make sure to add your splashcreen files to your res/xml directory under the appropriate folders. The second parameter represents how long the splashscreen will appear in milliseconds. It defaults to 3000 ms. See [Icons and Splash Screens](http://cordova.apache.org/docs/en/edge/config_ref_images.md.html)
 for more information.
@@ -74,6 +75,8 @@ for more information.
 
 The plugin reloads splash drawable whenever orientation changes, so you can specify different drawables for portrait and landscape orientations.
 
+"SplashShowOnlyFirstTime" preference is also optional and defaults to `true`. When set to `true` splash screen will only appear on application launch. However, if you plan to use `navigator.app.exitApp()` to close application and force splash screen appear on next launch, you should set this property to `false` (this also applies to closing the App with Back button).
+
 ### Browser Quirks
 
 You can use the following preferences in your `config.xml`:

http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/1e67606c/src/android/SplashScreen.java
----------------------------------------------------------------------
diff --git a/src/android/SplashScreen.java b/src/android/SplashScreen.java
index 75ad724..16bc769 100644
--- a/src/android/SplashScreen.java
+++ b/src/android/SplashScreen.java
@@ -89,7 +89,10 @@ public class SplashScreen extends CordovaPlugin {
         // Save initial orientation.
         orientation = cordova.getActivity().getResources().getConfiguration().orientation;
 
-        firstShow = false;
+        if (preferences.getBoolean("SplashShowOnlyFirstTime", true)) {
+            firstShow = false;
+        }
+
         loadSpinner();
         showSplashScreen(true);
     }


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