mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-01 02:12:58 +08:00
Merged code for bryfox: Re-add support for search & menu key triggers.
See original commit: 799515fa7b
This commit is contained in:
parent
5ffe5fa3c5
commit
28ff6e1150
@ -6,25 +6,27 @@
|
|||||||
* Copyright (c) 2010, IBM Corporation
|
* Copyright (c) 2010, IBM Corporation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function KeyEvent()
|
function KeyEvent() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyEvent.prototype.backTrigger = function()
|
KeyEvent.prototype.backTrigger = function() {
|
||||||
{
|
var e = document.createEvent('Events');
|
||||||
var e = document.createEvent('Events');
|
e.initEvent('backKeyDown');
|
||||||
e.initEvent('backKeyDown');
|
document.dispatchEvent(e);
|
||||||
document.dispatchEvent(e);
|
};
|
||||||
}
|
|
||||||
|
|
||||||
KeyEvent.prototype.menuTrigger = function()
|
KeyEvent.prototype.menuTrigger = function() {
|
||||||
{
|
var e = document.createEvent('Events');
|
||||||
var e = document.createEvent('Events');
|
e.initEvent('menuKeyDown');
|
||||||
e.initEvent('menuKeyDown');
|
document.dispatchEvent(e);
|
||||||
document.dispatchEvent(e);
|
};
|
||||||
}
|
|
||||||
|
|
||||||
if (document.keyEvent == null || typeof document.keyEvent == 'undefined')
|
KeyEvent.prototype.searchTrigger = function() {
|
||||||
{
|
var e = document.createEvent('Events');
|
||||||
window.keyEvent = document.keyEvent = new KeyEvent();
|
e.initEvent('searchKeyDown');
|
||||||
|
document.dispatchEvent(e);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (document.keyEvent == null || typeof document.keyEvent == 'undefined') {
|
||||||
|
window.keyEvent = document.keyEvent = new KeyEvent();
|
||||||
}
|
}
|
||||||
|
@ -816,11 +816,15 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keyCode == KeyEvent.KEYCODE_MENU) {
|
// If menu key
|
||||||
// This is where we launch the menu
|
else if (keyCode == KeyEvent.KEYCODE_MENU) {
|
||||||
appView.loadUrl("javascript:keyEvent.menuTrigger()");
|
appView.loadUrl("javascript:keyEvent.menuTrigger()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If search key
|
||||||
|
else if (keyCode == KeyEvent.KEYCODE_SEARCH) {
|
||||||
|
appView.loadUrl("javascript:keyEvent.searchTrigger()");
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user