Skip to content
Browse files

[BUG #6352] Fixed back button for new phonegap versions

  • Loading branch information...
1 parent 71c1367 commit 7b3d9ba80725116adec6b352243441bcc41ce32d tjbutz committed
Showing with 13 additions and 2 deletions.
  1. +13 −2 framework/source/class/qx/ui/mobile/page/manager/Simple.js
View
15 framework/source/class/qx/ui/mobile/page/manager/Simple.js
@@ -84,6 +84,7 @@ qx.Class.define("qx.ui.mobile.page.manager.Simple",
__pages : null,
__currentPage : null,
__root : null,
+ __deviceReadyHandler : null,
__backButtonHandler : null,
__menuButtonHandler : null,
@@ -95,10 +96,10 @@ qx.Class.define("qx.ui.mobile.page.manager.Simple",
{
if (qx.core.Environment.get("phonegap") && qx.core.Environment.get("os.name") == "android")
{
+ this.__deviceReadyHandler = qx.lang.Function.bind(this._onDeviceReady, this);
this.__backButtonHandler = qx.lang.Function.bind(this._onBackButton, this);
this.__menuButtonHandler = qx.lang.Function.bind(this._onMenuButton, this);
- qx.bom.Event.addNativeListener(document, "backbutton", this.__backButtonHandler);
- qx.bom.Event.addNativeListener(document, "menubutton", this.__menuButtonHandler);
+ qx.bom.Event.addNativeListener(document, "deviceready", this.__deviceReadyHandler);
}
},
@@ -110,10 +111,20 @@ qx.Class.define("qx.ui.mobile.page.manager.Simple",
{
if (qx.core.Environment.get("phonegap") && qx.core.Environment.get("os.name") == "android")
{
+ qx.bom.Event.removeNativeListener(document, "deviceready", this.__deviceReadyHandler);
qx.bom.Event.removeNativeListener(document, "backbutton", this.__backButtonHandler);
qx.bom.Event.removeNativeListener(document, "menubutton", this.__menuButtonHandler);
}
},
+
+
+ /**
+ * Event handler. Called when the device is ready.
+ */
+ _onDeviceReady : function() {
+ qx.bom.Event.addNativeListener(document, "backbutton", this.__backButtonHandler);
+ qx.bom.Event.addNativeListener(document, "menubutton", this.__menuButtonHandler);
+ },
/**

0 comments on commit 7b3d9ba

Please sign in to comment.
Something went wrong with that request. Please try again.