mirror of
https://github.com/apache/cordova-plugin-splashscreen.git
synced 2026-04-14 00:01:34 +08:00
Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e73b59024a | |||
| 01edc0ead2 | |||
| b998129669 | |||
| c9ff4b428b | |||
| 75f78b9032 | |||
| 02492654ef | |||
| 4b757c8e73 | |||
| 71ea946746 | |||
| 1cfd009c91 | |||
| 6c12ea4380 | |||
| 8326da4ee2 | |||
| b0543eee77 | |||
| 0b733d1797 | |||
| c2dea2fc02 | |||
| abc62a5eda | |||
| 2dc0f42b8f | |||
| 71a8c9cc33 | |||
| 52b6c539d3 | |||
| 10e7e9a1d5 | |||
| f1aed7d844 | |||
| 87a701004d | |||
| 4ce42a0c99 | |||
| d937fcb43b | |||
| 4275e57a73 | |||
| 1111c8b3b9 | |||
| 96d5875dc3 | |||
| 5f83eda5e8 |
@@ -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
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<!--
|
||||||
|
#
|
||||||
|
# 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,0 +1,53 @@
|
|||||||
|
---
|
||||||
|
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.
|
||||||
|
---
|
||||||
|
|
||||||
|
# iOS Configuration
|
||||||
|
|
||||||
|
The `config.xml` file controls an app's basic settings that apply
|
||||||
|
across each application and CordovaWebView instance. This section
|
||||||
|
details preferences that only apply to iOS builds. See The config.xml
|
||||||
|
File for information on global configuration options.
|
||||||
|
|
||||||
|
- `FadeSplashScreen` (boolean, defaults to `true`): Set to `false` to
|
||||||
|
prevent the splash screen from fading in and out when its display
|
||||||
|
state changes.
|
||||||
|
|
||||||
|
<preference name="FadeSplashScreen" value="false"/>
|
||||||
|
|
||||||
|
- `FadeSplashScreenDuration` (float, defaults to `2`): Specifies the
|
||||||
|
number of seconds for the splash screen fade effect to execute.
|
||||||
|
|
||||||
|
<preference name="FadeSplashScreenDuration" value="4"/>
|
||||||
|
|
||||||
|
- `ShowSplashScreenSpinner` (boolean, defaults to `true`): Set to `false`
|
||||||
|
to hide the splash-screen spinner.
|
||||||
|
|
||||||
|
<preference name="ShowSplashScreenSpinner" value="false"/>
|
||||||
|
|
||||||
|
- `KeyboardDisplayRequiresUserAction` (boolean, defaults to `true`):
|
||||||
|
Set to `false` to allow the keyboard to appear when calling
|
||||||
|
`focus()` on form inputs.
|
||||||
|
|
||||||
|
<preference name="KeyboardDisplayRequiresUserAction" value="false"/>
|
||||||
|
|
||||||
|
- `AutoHideSplashScreen` (boolean, defaults to `true`):
|
||||||
|
Set to `false` to control when the splashscreen is hidden through the plugin's JavaScript API.
|
||||||
|
|
||||||
|
<preference name="AutoHideSplashScreen" value="false"/>
|
||||||
|
|
||||||
+21
-2
@@ -1,12 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||||
id="org.apache.cordova.core.splashscreen"
|
id="org.apache.cordova.splashscreen"
|
||||||
version="0.2.0">
|
version="0.2.5">
|
||||||
<name>Splashscreen</name>
|
<name>Splashscreen</name>
|
||||||
<description>Cordova Splashscreen Plugin</description>
|
<description>Cordova Splashscreen Plugin</description>
|
||||||
<license>Apache 2.0</license>
|
<license>Apache 2.0</license>
|
||||||
<keywords>cordova,splashscreen</keywords>
|
<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">
|
<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" />
|
<source-file src="src/android/SplashScreen.java" target-dir="src/org/apache/cordova/splashscreen" />
|
||||||
</platform>
|
</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 -->
|
<!-- ios -->
|
||||||
<platform name="ios">
|
<platform name="ios">
|
||||||
<config-file target="config.xml" parent="/*">
|
<config-file target="config.xml" parent="/*">
|
||||||
|
|||||||
@@ -170,7 +170,9 @@
|
|||||||
// There's a special case when the image is the size of the screen.
|
// There's a special case when the image is the size of the screen.
|
||||||
if (CGSizeEqualToSize(screenSize, imgBounds.size)) {
|
if (CGSizeEqualToSize(screenSize, imgBounds.size)) {
|
||||||
CGRect statusFrame = [self.viewController.view convertRect:[UIApplication sharedApplication].statusBarFrame fromView:nil];
|
CGRect statusFrame = [self.viewController.view convertRect:[UIApplication sharedApplication].statusBarFrame fromView:nil];
|
||||||
imgBounds.origin.y -= statusFrame.size.height;
|
if (!(IsAtLeastiOSVersion(@"7.0"))) {
|
||||||
|
imgBounds.origin.y -= statusFrame.size.height;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
CGRect viewBounds = self.viewController.view.bounds;
|
CGRect viewBounds = self.viewController.view.bounds;
|
||||||
CGFloat imgAspect = imgBounds.size.width / imgBounds.size.height;
|
CGFloat imgAspect = imgBounds.size.width / imgBounds.size.height;
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
@@ -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
|
||||||
Vendored
+4
-2
@@ -20,7 +20,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var PLAT;
|
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';
|
PLAT = 'android';
|
||||||
} else if (/(iPad)|(iPhone)|(iPod)/.exec(navigator.userAgent)) {
|
} else if (/(iPad)|(iPhone)|(iPod)/.exec(navigator.userAgent)) {
|
||||||
PLAT = 'ios';
|
PLAT = 'ios';
|
||||||
@@ -61,7 +63,7 @@ if (!window._doNotWriteCordovaScript) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function backHome() {
|
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();
|
navigator.app.backHistory();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -19,75 +19,77 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*global Windows:true */
|
/*jslint sloppy:true */
|
||||||
|
/*global Windows:true, require, module, window, document, WinJS */
|
||||||
|
|
||||||
var cordova = require('cordova'),
|
var cordova = require('cordova'),
|
||||||
channel = require('cordova/channel');
|
channel = require('cordova/channel');
|
||||||
|
|
||||||
/* This is the actual implementation part that returns the result on Windows 8
|
/* 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 position = { x: 0, y: 0, width: 0, height: 0 }; // defined by evt.detail.splashScreen.imageLocation
|
||||||
var splash = null; //
|
var splash = null; //
|
||||||
var localSplash; // the image to display
|
var localSplash; // the image to display
|
||||||
var localSplashImage;
|
var localSplashImage;
|
||||||
var bgColor = "#464646";
|
var bgColor = "#464646";
|
||||||
|
|
||||||
function onResize(evt) {
|
|
||||||
if (splash) {
|
|
||||||
position = splash.imageLocation;
|
function updateImageLocation() {
|
||||||
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() {
|
module.exports = SplashScreen;
|
||||||
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;
|
|
||||||
|
|
||||||
function activated(evt) {
|
function activated(evt) {
|
||||||
if (evt.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) {
|
if (evt.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) {
|
||||||
splash = evt.detail.splashScreen;
|
splash = evt.detail.splashScreen;
|
||||||
position = evt.detail.splashScreen.imageLocation;
|
position = evt.detail.splashScreen.imageLocation;
|
||||||
SplashScreen.show();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,5 +102,5 @@ channel.onCordovaReady.subscribe(function (evt) {
|
|||||||
}, false);
|
}, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
require("cordova/commandProxy").add("SplashScreen",SplashScreen);
|
require("cordova/windows8/commandProxy").add("SplashScreen", SplashScreen);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user