本文整理汇总了TypeScript中application.android.on方法的典型用法代码示例。如果您正苦于以下问题:TypeScript android.on方法的具体用法?TypeScript android.on怎么用?TypeScript android.on使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类application.android
的用法示例。
在下文中一共展示了android.on方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: setStatusBarColors
export function setStatusBarColors() {
// Make the iOS status bar transparent with white text.
if (application.ios) {
application.on("launch", () => {
utils.ios.getter(UIApplication, UIApplication.sharedApplication).statusBarStyle = UIStatusBarStyle.LightContent;
});
}
// Make the Android status bar transparent.
// See http://bradmartin.net/2016/03/10/fullscreen-and-navigation-bar-color-in-a-nativescript-android-app/
// for details on the technique used.
if (application.android && platform.device.sdkVersion >= "21") {
application.android.on("activityStarted", () => {
const View = android.view.View;
const window = application.android.startActivity.getWindow();
window.setStatusBarColor(0x000000);
const decorView = window.getDecorView();
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
});
}
}
示例2: Promise
new Promise(function(resolve, reject) {
var callback = function(requestPermissionsEventData: AndroidRequestPermissionsResultEventData) {
if (requestPermissionsEventData.requestCode == CAMERA_PERMISSION_REQUEST_CODE) {
resolve(android.content.pm.PackageManager.PERMISSION_GRANTED == requestPermissionsEventData.grantResults[0]);
appInstance.off(AndroidApplication.requestPermissionsEvent, callback);
}
}
appInstance.on(AndroidApplication.requestPermissionsEvent, callback);
android.support.v4.app.ActivityCompat.requestPermissions(context, [android.Manifest.permission.CAMERA], CAMERA_PERMISSION_REQUEST_CODE);
});
示例3:
application.on("launch", args => {
console.log("onLaunch");
com.facebook.drawee.backends.pipeline.Fresco.initialize(application.android.context);
application.android.on("activityStarted", ({activity}) => {
console.log("onStarted");
var window = activity.getWindow();
if (window) {
window.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(0xFF151F2F));
// Prevent the soft keyboard from hiding EditText's while typing.
window.setSoftInputMode(32); //android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN;
}
});
});