Hacking together a work-around for the default back behaviour

This commit is contained in:
Joe Bowser
2010-06-08 15:55:57 -07:00
parent b65a0b1bd6
commit bb501de22c
3 changed files with 56 additions and 32 deletions
+26
View File
@@ -28,6 +28,32 @@ function Device() {
}
}
/*
* You must explicitly override the back button.
*/
Device.prototype.overrideBackButton = function()
{
BackButton.override();
}
/*
* This resets the back button to the default behaviour
*/
Device.prototype.resetBackButton = function()
{
BackButton.reset();
}
/*
* This terminates the activity!
*/
Device.prototype.exitApp = function()
{
BackButton.exitApp();
}
PhoneGap.addConstructor(function() {
navigator.device = window.device = new Device();
});
+2 -9
View File
@@ -2,17 +2,10 @@ function KeyEvent()
{
}
KeyEvent.prototype.menuTrigger = function()
KeyEvent.prototype.backTrigger = function()
{
var e = document.createEvent('Events');
e.initEvent('menuKeyDown');
document.dispatchEvent(e);
}
KeyEvent.prototype.searchTrigger= function()
{
var e = document.createEvent('Events');
e.initEvent('searchKeyDown');
e.initEvent('backKeyDown');
document.dispatchEvent(e);
}