Compare commits

...

33 Commits

Author SHA1 Message Date
Andrew Grieve
3c2813f505 CB-5719 Updated version and RELEASENOTES.md for release 0.2.6 2014-01-02 12:24:02 -05:00
Andrew Grieve
7c520181c3 CB-5658 Update license comment formatting of doc/index.md 2013-12-18 21:11:03 -05:00
Andrew Grieve
a5d40d0a95 CB-5658 Add doc.index.md for Splashscreen plugin 2013-12-18 20:59:29 -05:00
Andrew Grieve
c2d22c0671 CB-5658 Delete stale snapshot of plugin docs 2013-12-17 20:49:39 -05:00
Nathan Peles
d799eda020 Handle error when splash image is missing.
From pull request:
https://github.com/apache/cordova-plugin-splashscreen/pull/1
2013-12-06 14:38:28 -05:00
Steven Gill
9541c1eb37 [CB-5565] Incremented plugin version on dev branch. 2013-12-04 15:32:04 -08:00
Steven Gill
e73b59024a [CB-5565] Updated version and RELEASENOTES.md for release 0.2.5 2013-12-04 15:16:31 -08:00
Steven Gill
01edc0ead2 added ubuntu support 2013-12-02 16:29:17 -08:00
Steven Gill
b998129669 Merge branch 'dev' of github.com:archananaik/cordova-plugin-splashscreen into dev 2013-11-26 16:45:45 -08:00
Shazron Abdullah
c9ff4b428b CB-5124 - Remove splashscreen config.xml values from iOS Configuration Docs, move to plugin docs 2013-11-11 15:16:31 -08:00
Archana Naik
75f78b9032 Added amazon-fireos platform.
Change to use amazon-fireos as a platform if the user agent string contains 'cordova-amazon-fireos'
2013-10-30 14:51:44 -07:00
Steven Gill
02492654ef CB-5188: 2013-10-28 12:27:16 -07:00
Steven Gill
4b757c8e73 Merge branch 'dev' 2013-10-28 12:13:55 -07:00
Steven Gill
71ea946746 [CB-5188] Updated version and RELEASENOTES.md for release 0.2.4 2013-10-28 12:08:11 -07:00
hermwong
1cfd009c91 CB-5128: add repo + issue tag to plugin.xml for splashscreen plugin 2013-10-22 14:02:04 -07:00
Maxim Ermilov
6c12ea4380 add ubuntu platform 2013-10-16 22:16:33 +04:00
Steven Gill
8326da4ee2 [CB-5010] Incremented plugin version on dev branch. 2013-10-09 16:06:49 -07:00
Steven Gill
b0543eee77 Merge branch 'dev' 2013-10-09 15:44:00 -07:00
Steven Gill
0b733d1797 [CB-5010] Updated version and RELEASENOTES.md for release 0.2.3 2013-10-09 15:33:12 -07:00
Shazron Abdullah
c2dea2fc02 [CB-4806] (Re-fix) Update splashscreen image bounds for iOS 7 2013-10-01 13:26:05 -07:00
purplecabbage
abc62a5eda Merge branch 'CB-4934' of https://github.com/csantanapr/cordova-plugin-splashscreen into dev 2013-09-26 16:14:11 -07:00
Carlos Santana
2dc0f42b8f [CB-4934] plugin-splashscreen should not show by default on Windows8 2013-09-26 17:54:43 -04:00
Carlos Santana
71a8c9cc33 [CB-4929] plugin-splashscreen not loading proxy windows8 2013-09-26 15:20:22 -04:00
Steven Gill
52b6c539d3 [CB-4915] Incremented plugin version on dev branch. 2013-09-25 18:34:15 -07:00
Steven Gill
10e7e9a1d5 Merge branch 'dev' 2013-09-25 18:19:29 -07:00
Steven Gill
f1aed7d844 [CB-4915] Updated version and RELEASENOTES.md for release 0.2.2 2013-09-25 17:56:18 -07:00
Anis Kadri
87a701004d CB-4889 bumping&resetting version 2013-09-25 17:50:50 +02:00
Anis Kadri
4ce42a0c99 CB-4889 renaming org.apache.cordova.core.splashscreen to org.apache.cordova.splashscreen 2013-09-21 12:38:51 +02:00
Andrew Grieve
d937fcb43b Rename CHANGELOG.md -> RELEASENOTES.md 2013-09-17 11:36:13 -04:00
Shazron Abdullah
4275e57a73 Revert "[CB-4806] Update splashscreen image bounds for iOS 7"
This reverts commit 96d5875dc3.
2013-09-16 17:27:09 -07:00
Shazron Abdullah
1111c8b3b9 [CB-4806] Update splashscreen image bounds for iOS 7 2013-09-16 17:26:48 -07:00
Shazron Abdullah
96d5875dc3 [CB-4806] Update splashscreen image bounds for iOS 7 2013-09-13 15:58:36 -07:00
Andrew Grieve
5f83eda5e8 [CB-4752] Incremented plugin version on dev branch. 2013-09-06 00:58:22 -04:00
13 changed files with 341 additions and 339 deletions

View File

@@ -1,23 +0,0 @@
<!--
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
-->
# Release Notes

View File

@@ -1,18 +1,22 @@
cordova-plugin-splashscreen
----------------------------
<!---
license: Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
For Android,
http://www.apache.org/licenses/LICENSE-2.0
In your config.xml, you need to add the following preference
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
`<preference name="splashscreen" value="foo" />`
# org.apache.cordova.splashscreen
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.
For Android, you also have to edit your projects main java file. You must add a second parameter representing a time delay to your super.loadUrl.
`super.loadUrl(Config.getStartUrl(), 10000);`
To install this plugin, follow the [Command-line Interface Guide](http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface).
If you are not using the Cordova Command-line Interface, follow [Using Plugman to Manage Plugins](http://cordova.apache.org/docs/en/edge/plugin_ref_plugman.md.html).
Plugin documentation: [doc/index.md](doc/index.md)

47
RELEASENOTES.md Normal file
View File

@@ -0,0 +1,47 @@
<!--
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
-->
# Release Notes
### 0.2.2 (Sept 25, 2013)
* CB-4889 bumping&resetting version
* CB-4889 renaming org.apache.cordova.core.splashscreen to org.apache.cordova.splashscreen
* Rename CHANGELOG.md -> RELEASENOTES.md
* [CB-4806] Update splashscreen image bounds for iOS 7
* [CB-4752] Incremented plugin version on dev branch.
### 0.2.3 (Oct 9, 2013)
* [CB-4806] (Re-fix) Update splashscreen image bounds for iOS 7
* [CB-4934] plugin-splashscreen should not show by default on Windows8
* [CB-4929] plugin-splashscreen not loading proxy windows8
* [CB-4915] Incremented plugin version on dev branch.
### 0.2.4 (Oct 28, 2013)
* CB-5128: add repo + issue tag to plugin.xml for splashscreen plugin
* [CB-5010] Incremented plugin version on dev branch.
### 0.2.5 (Dec 4, 2013)
* add ubuntu platform
* Added amazon-fireos platform. Change to use amazon-fireos as a platform if the user agent string contains 'cordova-amazon-fireos'
* CB-5124 - Remove splashscreen config.xml values from iOS Configuration Docs, move to plugin docs
### 0.2.6 (Jan 02, 2014)
* CB-5658 Add doc/index.md for Splashscreen plugin
* Handle error when splash image is missing.

94
doc/index.md Normal file
View File

@@ -0,0 +1,94 @@
<!---
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# org.apache.cordova.splashscreen
This plugin displays and hides a splash screen during application launch.
## Installation
cordova plugin add org.apache.cordova.splashscreen
## Supported Platforms
- Amazon Fire OS
- Android
- BlackBerry 10
- iOS
- Windows Phone 7 and 8
- Windows 8
## Methods
- splashscreen.show
- splashscreen.hide
### Android Quirks
In your config.xml, you need to add the following preference
`<preference name="splashscreen" value="foo" />`
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.
For Android, you also have to edit your projects main java file. You must add a second parameter representing a time delay to your super.loadUrl.
`super.loadUrl(Config.getStartUrl(), 10000);`
## splashscreen.hide
Dismiss the splash screen.
navigator.splashscreen.hide();
### BlackBerry 10 Quirk
The `config.xml` file's `AutoHideSplashScreen` setting must be `false`.
### iOS Quirk
The `config.xml` file's `AutoHideSplashScreen` setting must be
`false`. To delay hiding the splash screen for two seconds, add a
timer such as the following in the `deviceready` event handler:
setTimeout(function() {
navigator.splashscreen.hide();
}, 2000);
## splashscreen.show
Displays the splash screen.
navigator.splashscreen.show();
Your application cannot call `navigator.splashscreen.show()` until the app has
started and the `deviceready` event has fired. But since typically the splash
screen is meant to be visible before your app has started, that would seem to
defeat the purpose of the splash screen. Providing some configuration in
`config.xml` will automatically `show` the splash screen immediately after your
app launch and before it has fully started and received the `deviceready`
event. See [Icons and Splash Screens](http://cordova.apache.org/docs/en/edge/config_ref_images.md.html)
for more information on doing this configuration. For this reason, it is
unlikely you need to call `navigator.splashscreen.show()` to make the splash
screen visible for app startup.

View File

@@ -1,80 +0,0 @@
---
license: Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
---
hide
===============
Dismiss the splash screen.
navigator.splashscreen.hide();
Description
-----------
navigator.splashscreen.hide() dismisses the applications splash screen.
Supported Platforms
-------------------
- Android
- iOS
Quick Example
-------------
navigator.splashscreen.hide();
Full Example
------------
<!DOCTYPE html>
<html>
<head>
<title>Splashscreen Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for Cordova to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// Cordova is ready
//
function onDeviceReady() {
navigator.splashscreen.hide();
}
</script>
</head>
<body>
<h1>Example</h1>
</body>
</html>
iOS Quirk
------------
1. In your **config.xml**, you need to [modify the value](guide_project-settings_index.md.html#Project%20Settings) for **"AutoHideSplashScreen”** to false
2. Then, if you want to delay hiding the splash screen for 2 seconds, you can do this in your **deviceready** event handler:
setTimeout(function() {
navigator.splashscreen.hide();
}, 2000);

View File

@@ -1,90 +0,0 @@
---
license: Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
---
Splashscreen
==========
> Enables developers to show/hide the application's splash screen.
Methods
-------
- show
- hide
Permissions
-----------
### Android
#### app/res/xml/config.xml
<plugin name="SplashScreen" value="org.apache.cordova.SplashScreen"/>
### iOS
#### config.xml
<plugin name="SplashScreen" value="CDVSplashScreen" />
Setup
-----
### Android
1. Copy your splash screen image into the res/drawable directories of your Android project. The sizes of each image should be:
- xlarge (xhdpi): at least 960 x 720
- large (hdpi): at least 640 x 480
- medium (mdpi): at least 470 x 320
- small (ldpi): at least 426 x 320
It is highly recommended that you use a [9-patch image](https://developer.android.com/tools/help/draw9patch.html) for your splash screen.
2. In the onCreate method of the class that extends DroidGap add the following two lines:
super.setIntegerProperty("splashscreen", R.drawable.splash);
super.loadUrl(Config.getStartUrl(), 10000);
The first line 'super.setIntegerProperty' sets the image to be displayed as the splashscreen. If you have named your image anything other than splash.png you will have to modify this line.
The second line is the normal 'super.loadUrl' line but it has a second parameter which is the timeout value for the splash screen. In this example the splash screen will display for 10 seconds. If you want to dismiss the splash screen once you get the "deviceready" event you should call the navigator.splashscreen.hide() method.
### iOS
1. Copy your splash screen images into the **Resources/splash** directory of your iOS project. Only add the images for the devices you want to support (iPad screen size or iPhone screen size). The sizes of each image should be:
- Default-568h@2x~iphone.png (640x1136 pixels)
- Default-Landscape@2x~ipad.png (2048x1496 pixels)
- Default-Landscape~ipad.png (1024x748 pixels)
- Default-Portrait@2x~ipad.png (1536x2008 pixels)
- Default-Portrait~ipad.png (768x1004 pixels)
- Default@2x~iphone.png (640x960 pixels)
- Default~iphone.png (320x480 pixels)
### BlackBerry10
## Quirks
The SplashScreen BlackBerry10 plugin implements hide(), but show() is not possible using the built in OS mechanism. The advantage to using this is the splash screen is displayed before WebKit boots and issupports multiple images for various device resolutions and orientations.
We also implemented the AutoHideSplashScreen config.xml value, similar to iOS.

View File

@@ -1,69 +0,0 @@
---
license: Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
---
show
===============
Displays the splash screen.
navigator.splashscreen.show();
Description
-----------
navigator.splashscreen.show() displays the applications splash screen.
Supported Platforms
-------------------
- Android
- iOS
Quick Example
-------------
navigator.splashscreen.show();
Full Example
------------
<!DOCTYPE html>
<html>
<head>
<title>Splashscreen Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for Cordova to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// Cordova is ready
//
function onDeviceReady() {
navigator.splashscreen.show();
}
</script>
</head>
<body>
<h1>Example</h1>
</body>
</html>

View File

@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="org.apache.cordova.core.splashscreen"
version="0.2.0">
id="org.apache.cordova.splashscreen"
version="0.2.6">
<name>Splashscreen</name>
<description>Cordova Splashscreen Plugin</description>
<license>Apache 2.0</license>
<keywords>cordova,splashscreen</keywords>
<repo>https://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen.git</repo>
<issue>https://issues.apache.org/jira/browse/CB/component/12320653</issue>
<js-module src="www/splashscreen.js" name="SplashScreen">
@@ -24,6 +26,23 @@
<source-file src="src/android/SplashScreen.java" target-dir="src/org/apache/cordova/splashscreen" />
</platform>
<!-- amazon-fireos -->
<platform name="amazon-fireos">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="SplashScreen">
<param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen"/>
</feature>
</config-file>
<source-file src="src/android/SplashScreen.java" target-dir="src/org/apache/cordova/splashscreen" />
</platform>
<!-- ubuntu -->
<platform name="ubuntu">
<header-file src="src/ubuntu/splashscreen.h" />
<source-file src="src/ubuntu/splashscreen.cpp" />
</platform>
<!-- ios -->
<platform name="ios">
<config-file target="config.xml" parent="/*">

View File

@@ -163,15 +163,17 @@
- (void)updateBounds
{
UIImage* img = _imageView.image;
CGRect imgBounds = CGRectMake(0, 0, img.size.width, img.size.height);
CGRect imgBounds = (img) ? CGRectMake(0, 0, img.size.width, img.size.height) : CGRectZero;
CGSize screenSize = [self.viewController.view convertRect:[UIScreen mainScreen].bounds fromView:nil].size;
// There's a special case when the image is the size of the screen.
if (CGSizeEqualToSize(screenSize, imgBounds.size)) {
CGRect statusFrame = [self.viewController.view convertRect:[UIApplication sharedApplication].statusBarFrame fromView:nil];
imgBounds.origin.y -= statusFrame.size.height;
} else {
if (!(IsAtLeastiOSVersion(@"7.0"))) {
imgBounds.origin.y -= statusFrame.size.height;
}
} else if (imgBounds.size.width > 0) {
CGRect viewBounds = self.viewController.view.bounds;
CGFloat imgAspect = imgBounds.size.width / imgBounds.size.height;
CGFloat viewAspect = viewBounds.size.width / viewBounds.size.height;

View File

@@ -0,0 +1,42 @@
/*
*
* Copyright 2013 Canonical Ltd.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
#include <QQuickItem>
#include "splashscreen.h"
#include <cordova.h>
#define SPLASHSCREEN_STATE_NAME "splashscreen"
Splashscreen::Splashscreen(Cordova *cordova): CPlugin(cordova) {
}
void Splashscreen::show(int, int) {
m_cordova->rootObject()->setProperty("splashscreenPath", m_cordova->getSplashscreenPath());
m_cordova->pushViewState(SPLASHSCREEN_STATE_NAME);
}
void Splashscreen::hide(int, int) {
m_cordova->popViewState(SPLASHSCREEN_STATE_NAME);
}

52
src/ubuntu/splashscreen.h Normal file
View File

@@ -0,0 +1,52 @@
/*
*
* Copyright 2013 Canonical Ltd.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
#ifndef SPLASHSCREEN_H
#define SPLASHSCREEN_H
#include <QtCore>
#include <cplugin.h>
class Splashscreen: public CPlugin {
Q_OBJECT
public:
explicit Splashscreen(Cordova *cordova);
virtual const QString fullName() override {
return Splashscreen::fullID();
}
virtual const QString shortName() override {
return "SplashScreen";
}
static const QString fullID() {
return "SplashScreen";
}
public slots:
void show(int, int);
void hide(int, int);
};
#endif // SPLASHSCREEN_H

View File

@@ -20,7 +20,9 @@
*/
var PLAT;
if (/Android/.exec(navigator.userAgent)) {
if (/cordova-amazon-fireos/.exec(navigator.userAgent)) {
PLAT = 'amazon-fireos';
} else if (/Android/.exec(navigator.userAgent)) {
PLAT = 'android';
} else if (/(iPad)|(iPhone)|(iPod)/.exec(navigator.userAgent)) {
PLAT = 'ios';
@@ -61,7 +63,7 @@ if (!window._doNotWriteCordovaScript) {
}
function backHome() {
if (window.device && device.platform && device.platform.toLowerCase() == 'android') {
if (window.device && device.platform && (device.platform.toLowerCase() == 'android' || device.platform.toLowerCase() == 'amazon-fireos')) {
navigator.app.backHistory();
}
else {

View File

@@ -19,75 +19,77 @@
*
*/
/*global Windows:true */
/*jslint sloppy:true */
/*global Windows:true, require, module, window, document, WinJS */
var cordova = require('cordova'),
channel = require('cordova/channel');
var cordova = require('cordova'),
channel = require('cordova/channel');
/* This is the actual implementation part that returns the result on Windows 8
*/
var position = { x: 0, y: 0, width: 0, height: 0 }; // defined by evt.detail.splashScreen.imageLocation
var splash = null; //
var localSplash; // the image to display
var localSplashImage;
var bgColor = "#464646";
var position = { x: 0, y: 0, width: 0, height: 0 }; // defined by evt.detail.splashScreen.imageLocation
var splash = null; //
var localSplash; // the image to display
var localSplashImage;
var bgColor = "#464646";
function onResize(evt) {
if (splash) {
position = splash.imageLocation;
updateImageLocation();
function updateImageLocation() {
localSplash.style.width = window.innerWidth + "px";
localSplash.style.height = window.innerHeight + "px";
localSplash.style.top = "0px";
localSplash.style.left = "0px";
localSplashImage.style.top = position.y + "px";
localSplashImage.style.left = position.x + "px";
localSplashImage.style.height = position.height + "px";
localSplashImage.style.width = position.width + "px";
}
function onResize(evt) {
if (splash) {
position = splash.imageLocation;
updateImageLocation();
}
}
var SplashScreen = {
setBGColor: function (cssBGColor) {
bgColor = cssBGColor;
if (localSplash) {
localSplash.style.backgroundColor = bgColor;
}
},
show: function () {
window.addEventListener("resize", onResize, false);
localSplash = document.createElement("div");
localSplash.style.backgroundColor = bgColor;
localSplash.style.position = "absolute";
localSplashImage = document.createElement("img");
localSplashImage.src = "img/splashscreen.png";
localSplashImage.style.position = "absolute";
updateImageLocation();
localSplash.appendChild(localSplashImage);
document.body.appendChild(localSplash);
},
hide: function () {
window.removeEventListener("resize", onResize, false);
document.body.removeChild(localSplash);
localSplash = null;
}
};
function updateImageLocation() {
localSplash.style.width = window.innerWidth + "px";
localSplash.style.height = window.innerHeight + "px";
localSplash.style.top = "0px";
localSplash.style.left = "0px";
localSplashImage.style.top = position.y + "px";
localSplashImage.style.left = position.x + "px";
localSplashImage.style.height = position.height + "px";
localSplashImage.style.width = position.width + "px";
}
var SplashScreen = {
setBGColor:function(cssBGColor) {
bgColor = cssBGColor;
if (localSplash) {
localSplash.style.backgroundColor = bgColor;
}
},
show:function(){
window.addEventListener("resize", onResize, false);
localSplash = document.createElement("div");
localSplash.style.backgroundColor = bgColor;;
localSplash.style.position = "absolute";
var img = localSplashImage = document.createElement("img");
img.src = "img/splashscreen.png";
img.style.position = "absolute";
updateImageLocation();
localSplash.appendChild(localSplashImage);
document.body.appendChild(localSplash);
},
hide:function(){
window.removeEventListener("resize", onResize, false);
document.body.removeChild(localSplash);
localSplash = null;
}
}
module.exports = SplashScreen;
module.exports = SplashScreen;
function activated(evt) {
if (evt.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) {
splash = evt.detail.splashScreen;
position = evt.detail.splashScreen.imageLocation;
SplashScreen.show();
}
}
@@ -100,5 +102,5 @@ channel.onCordovaReady.subscribe(function (evt) {
}, false);
});
require("cordova/commandProxy").add("SplashScreen",SplashScreen);
require("cordova/windows8/commandProxy").add("SplashScreen", SplashScreen);