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
69
gaia/dev_apps/test-keyboard-app/js/main.js
Executable file
69
gaia/dev_apps/test-keyboard-app/js/main.js
Executable file
|
|
@ -0,0 +1,69 @@
|
|||
var inputContext = null;
|
||||
var keyboardElement;
|
||||
|
||||
function init() {
|
||||
keyboardElement = document.getElementById('keyboard');
|
||||
|
||||
window.navigator.mozInputMethod.oninputcontextchange = function() {
|
||||
inputContext = navigator.mozInputMethod.inputcontext;
|
||||
resizeWindow();
|
||||
};
|
||||
|
||||
window.addEventListener('resize', resizeWindow);
|
||||
|
||||
keyboardElement.addEventListener('mousedown', function onMouseDown(evt) {
|
||||
// Prevent loosing focus to the currently focused app
|
||||
// Otherwise, right after mousedown event, the app will receive a focus event.
|
||||
evt.preventDefault();
|
||||
});
|
||||
|
||||
var sendKeyElement = document.getElementById('sendKey');
|
||||
sendKeyElement.addEventListener('click', function sendKeyHandler() {
|
||||
var testString = '\\o/';
|
||||
for (var i = 0; i < testString.length; i++) {
|
||||
sendKey(testString.charCodeAt(i));
|
||||
}
|
||||
});
|
||||
|
||||
var switchElement = document.getElementById('switchLayout');
|
||||
switchElement.addEventListener('click', function switchHandler() {
|
||||
var mgmt = navigator.mozInputMethod.mgmt;
|
||||
mgmt.next();
|
||||
});
|
||||
|
||||
// long press to trigger IME menu
|
||||
var menuTimeout = 0;
|
||||
switchElement.addEventListener('touchstart', function longHandler() {
|
||||
menuTimeout = window.setTimeout(function menuTimeout() {
|
||||
var mgmt = navigator.mozInputMethod.mgmt;
|
||||
mgmt.showAll();
|
||||
}, 700);
|
||||
});
|
||||
|
||||
switchElement.addEventListener('touchend', function longHandler() {
|
||||
clearTimeout(menuTimeout);
|
||||
});
|
||||
}
|
||||
|
||||
function resizeWindow() {
|
||||
window.resizeTo(window.innerWidth, keyboardElement.clientHeight);
|
||||
}
|
||||
|
||||
function sendKey(keyCode) {
|
||||
switch (keyCode) {
|
||||
case KeyEvent.DOM_VK_BACK_SPACE:
|
||||
case KeyEvent.DOM_VK_RETURN:
|
||||
if (inputContext) {
|
||||
inputContext.sendKey(keyCode, 0, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (inputContext) {
|
||||
inputContext.sendKey(0, keyCode, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('load', init);
|
||||
12
gaia/dev_apps/test-keyboard-app/js/settings.js
Executable file
12
gaia/dev_apps/test-keyboard-app/js/settings.js
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
document.getElementById('back').addEventListener('click', function() {
|
||||
document.addEventListener('visibilitychange', function() {
|
||||
// Close ourself after the activity transition is completed.
|
||||
window.close();
|
||||
});
|
||||
var activity = new MozActivity({
|
||||
name: 'configure',
|
||||
data: {
|
||||
target: 'device'
|
||||
}
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue