Resolved Issue #391: Added cancellable Android activityBackPressed event + fixed the names of the other activity events because they were wrong.

This commit is contained in:
Rossen Hristov
2015-07-06 11:54:45 +03:00
parent 95b616edb3
commit 7a197a6711
4 changed files with 46 additions and 9 deletions

View File

@@ -494,6 +494,19 @@ var NativeActivity = {
onBackPressed: function () {
trace.write("NativeScriptActivity.onBackPressed;", trace.categories.NativeLifecycle);
var args = <application.AndroidActivityBackPressedEventData>{
eventName: application.androidActivityBackPressedEvent,
object: application.android,
activity: this,
cancel: false,
};
application.notify(args);
if (args.cancel) {
return;
}
if (!frameCommon.goBack()) {
this.super.onBackPressed();
}