Created
July 2, 2018 11:02
-
-
Save RoyiNamir/c13cdf53f2ab81e51bec5e797dc7ac7a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {ReplaySubject} from "rxjs"; | |
import {setActivityCallbacks, AndroidActivityCallbacks} from "ui/frame"; | |
export var AndroidOnRouteToURL = new ReplaySubject<string>(); | |
@JavaProxy("org.myApp.MainActivity") | |
class Activity extends android.support.v7.app.AppCompatActivity { | |
private _callbacks: AndroidActivityCallbacks; | |
protected onCreate(savedInstanceState: android.os.Bundle): void { | |
if (!this._callbacks) { | |
setActivityCallbacks(this); | |
} | |
console.log("onCreate"); | |
this._callbacks.onCreate(this, savedInstanceState, super.onCreate); | |
} | |
protected onSaveInstanceState(outState: android.os.Bundle): void { | |
this._callbacks.onSaveInstanceState(this, outState, super.onSaveInstanceState); | |
} | |
protected onStart(): void { | |
this._callbacks.onStart(this, super.onStart); | |
} | |
protected onStop(): void { | |
this._callbacks.onStop(this, super.onStop); | |
} | |
protected onDestroy(): void { | |
this._callbacks.onDestroy(this, super.onDestroy); | |
} | |
public onBackPressed(): void { | |
this._callbacks.onBackPressed(this, super.onBackPressed); | |
} | |
public onRequestPermissionsResult(requestCode: number, permissions: Array<String>, grantResults: Array<number>): void { | |
this._callbacks.onRequestPermissionsResult(this, requestCode, permissions, grantResults, undefined /*TODO: Enable if needed*/); | |
} | |
protected onActivityResult(requestCode: number, resultCode: number, data: android.content.Intent): void { | |
this._callbacks.onActivityResult(this, requestCode, resultCode, data, super.onActivityResult); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment