mirror of
https://github.com/apache/cordova-android.git
synced 2026-05-11 00:00:05 +08:00
Hacking together a work-around for the default back behaviour
This commit is contained in:
@@ -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,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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user