CB-9374 Android: add SplashShowOnlyFirstTime as preference

Github: close #70
This commit is contained in:
Wilson Pinto 2015-12-26 18:36:37 +00:00 committed by daserge
parent fa3b665223
commit 1e67606c60
2 changed files with 7 additions and 1 deletions

View File

@ -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`:

View File

@ -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);
}