Adding menu event and buttons

This commit is contained in:
Joe Bowser 2009-12-17 13:21:13 -08:00
parent 9a53dd7683
commit de5b3e2c0f
2 changed files with 24 additions and 2 deletions

View File

@ -252,12 +252,12 @@ public class DroidGap extends Activity {
if (keyCode == KeyEvent.KEYCODE_MENU)
{
appView.loadUrl("javascript:fireMenuEvent()");
appView.loadUrl("javascript:keyEvent.menuTrigger()");
}
if (keyCode == KeyEvent.KEYCODE_SEARCH)
{
appView.loadUrl("javascript:fireSearchEvent()");
appView.loadUrl("javascript:keyEvent.searchTrigger()");
}
return false;

22
js/keyevent.js Normal file
View File

@ -0,0 +1,22 @@
function KeyEvent()
{
}
KeyEvent.prototype.menuTrigger = function()
{
var e = document.createEvent('Events');
e.initEvent('menuKeyDown');
document.dispatchEvent(e);
}
KeyEvent.prototype.searchTrigger= function()
{
var e = document.createEvent('Events');
e.initEvent('searchKeyDown');
document.dispatchEvent(e);
}
if (document.keyEvent == null || typeof document.keyEvent == 'undefined')
{
window.keyEvent = document.keyEvent = new KeyEvent();
}