mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
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:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user