This repository was archived by the owner on Aug 7, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathactivity.android.js
36 lines (34 loc) · 1.53 KB
/
activity.android.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const frame = require("@nativescript/core/ui/frame");
const superProto = androidx.appcompat.app.AppCompatActivity.prototype;
androidx.appcompat.app.AppCompatActivity.extend("org.myApp.MainActivity", {
onCreate: function(savedInstanceState) {
// Set isNativeScriptActivity in onCreate.
// The JS constructor might not be called because the activity is created from Android.
this.isNativeScriptActivity = true;
if(!this._callbacks) {
frame.setActivityCallbacks(this);
}
this._callbacks.onCreate(this, savedInstanceState, this.getIntent(), superProto.onCreate);
},
onSaveInstanceState: function(outState) {
this._callbacks.onSaveInstanceState(this, outState, superProto.onSaveInstanceState);
},
onStart: function() {
this._callbacks.onStart(this, superProto.onStart);
},
onStop: function() {
this._callbacks.onStop(this, superProto.onStop);
},
onDestroy: function() {
this._callbacks.onDestroy(this, superProto.onDestroy);
},
onBackPressed: function() {
this._callbacks.onBackPressed(this, superProto.onBackPressed);
},
onRequestPermissionsResult: function (requestCode, permissions, grantResults) {
this._callbacks.onRequestPermissionsResult(this, requestCode, permissions, grantResults, undefined);
},
onActivityResult: function (requestCode, resultCode, data) {
this._callbacks.onActivityResult(this, requestCode, resultCode, data, _super.prototype.onActivityResult);
}
});