Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
32
gaia/dev_apps/test-receiver-inline/index.html
Executable file
32
gaia/dev_apps/test-receiver-inline/index.html
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1">
|
||||
<meta charset="utf-8">
|
||||
<title>Test Receiver</title>
|
||||
<script src="js/inline-receiver.js" defer></script>
|
||||
<style>
|
||||
button {
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
input {
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: #e0e0e0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Inline Web Activities receiver</h1>
|
||||
<p><button disabled id="button">Send "Hello Back!"</button></p>
|
||||
<!-- add an input field to test keyboard work well -->
|
||||
<p><input type="number" id="number" size="4" /></p>
|
||||
<p><button disabled id="cancelButton">Cancel</button></p>
|
||||
<p><button id="promptButton">Prompt</button></p>
|
||||
<p><button id="go">Go</button></p>
|
||||
<p>Result<span id="result"></span></p>
|
||||
</body>
|
||||
</html>
|
||||
93
gaia/dev_apps/test-receiver-inline/js/inline-receiver.js
Executable file
93
gaia/dev_apps/test-receiver-inline/js/inline-receiver.js
Executable file
|
|
@ -0,0 +1,93 @@
|
|||
var activityRequest;
|
||||
document.getElementById('go').onclick = function _go() {
|
||||
var a = new MozActivity(
|
||||
{
|
||||
name: 'test',
|
||||
data: {
|
||||
type: 'inline'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
a.onsuccess = function () {
|
||||
document.getElementById('result').textContent = this.result.text;
|
||||
};
|
||||
|
||||
a.onerror = function() {
|
||||
document.getElementById('result').textContent = '(canceled)';
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
var webActivityHandler = function (request) {
|
||||
activityRequest = request;
|
||||
|
||||
document.getElementById('button').disabled = '';
|
||||
document.getElementById('cancelButton').disabled = '';
|
||||
document.getElementById('number').focus();
|
||||
|
||||
};
|
||||
|
||||
window.onload = function () {
|
||||
document.getElementById('button').onclick = go;
|
||||
document.getElementById('cancelButton').onclick = cancel;
|
||||
document.getElementById('promptButton').onclick = promptButton;
|
||||
|
||||
// If the app is being loaded because a inline disposition web activity,
|
||||
// it will came with a pending system message.
|
||||
if (!navigator.mozHasPendingMessage('activity')) {
|
||||
console.warn('This application is not intend to launch directly.');
|
||||
} else {
|
||||
// Register for activity system message handling.
|
||||
// Do NOT register for message handling on the main app frame.
|
||||
|
||||
}
|
||||
navigator.mozSetMessageHandler('activity', webActivityHandler);
|
||||
};
|
||||
|
||||
var go = function go() {
|
||||
if (!activityRequest) {
|
||||
alert('There are no any pending activity request.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Return the request
|
||||
activityRequest.postResult({
|
||||
type: 'inline',
|
||||
text: 'Hello back!'
|
||||
});
|
||||
activityRequest = null;
|
||||
|
||||
// close app, currently useless,
|
||||
// see https://bugzilla.mozilla.org/show_bug.cgi?id=789392
|
||||
window.close();
|
||||
};
|
||||
|
||||
var cancel = function cancel() {
|
||||
if (!activityRequest) {
|
||||
alert('There are no any pending activity request.');
|
||||
return;
|
||||
}
|
||||
|
||||
activityRequest.postError('canceled');
|
||||
activityRequest = null;
|
||||
|
||||
// close app, currently useless,
|
||||
// see https://bugzilla.mozilla.org/show_bug.cgi?id=789392
|
||||
window.close();
|
||||
};
|
||||
|
||||
var promptButton = function promptButton() {
|
||||
var a = prompt('inline-activty prompt!');
|
||||
document.getElementById('result').textContent = a;
|
||||
};
|
||||
|
||||
// When the app is being closed or killed, we will cancel the pending
|
||||
// request.
|
||||
document.addEventListener('visibilitychange', function visibility(e) {
|
||||
if (!document.hidden || !activityRequest)
|
||||
return;
|
||||
|
||||
activityRequest.postError('canceled');
|
||||
activityRequest = null;
|
||||
});
|
||||
25
gaia/dev_apps/test-receiver-inline/manifest.webapp
Executable file
25
gaia/dev_apps/test-receiver-inline/manifest.webapp
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"name": "Test receiver (inline)",
|
||||
"description": "Dummy app to respond to Test web activities",
|
||||
"launch_path": "/index.html",
|
||||
"developer": {
|
||||
"name": "The Gaia Team",
|
||||
"url": "https://github.com/mozilla-b2g/gaia"
|
||||
},
|
||||
"activities": {
|
||||
"test": {
|
||||
"filters": {
|
||||
"type": "inline"
|
||||
},
|
||||
"disposition": "inline",
|
||||
"returnValue": true
|
||||
}
|
||||
},
|
||||
"icons": {
|
||||
"84": "/style/icons/test-receiver_84.png",
|
||||
"126": "/style/icons/test-receiver_126.png",
|
||||
"142": "/style/icons/test-receiver_142.png",
|
||||
"189": "/style/icons/test-receiver_189.png",
|
||||
"284": "/style/icons/test-receiver_284.png"
|
||||
}
|
||||
}
|
||||
BIN
gaia/dev_apps/test-receiver-inline/style/icons/test-receiver_126.png
Executable file
BIN
gaia/dev_apps/test-receiver-inline/style/icons/test-receiver_126.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 2 KiB |
BIN
gaia/dev_apps/test-receiver-inline/style/icons/test-receiver_142.png
Executable file
BIN
gaia/dev_apps/test-receiver-inline/style/icons/test-receiver_142.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
BIN
gaia/dev_apps/test-receiver-inline/style/icons/test-receiver_189.png
Executable file
BIN
gaia/dev_apps/test-receiver-inline/style/icons/test-receiver_189.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
BIN
gaia/dev_apps/test-receiver-inline/style/icons/test-receiver_284.png
Executable file
BIN
gaia/dev_apps/test-receiver-inline/style/icons/test-receiver_284.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 4.8 KiB |
BIN
gaia/dev_apps/test-receiver-inline/style/icons/test-receiver_84.png
Executable file
BIN
gaia/dev_apps/test-receiver-inline/style/icons/test-receiver_84.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
Loading…
Reference in a new issue