当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript android.off方法代码示例

本文整理汇总了TypeScript中tns-core-modules/application.android.off方法的典型用法代码示例。如果您正苦于以下问题:TypeScript android.off方法的具体用法?TypeScript android.off怎么用?TypeScript android.off使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tns-core-modules/application.android的用法示例。


在下文中一共展示了android.off方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

          const onResult = function(args) {
            const requestCode = args.requestCode;
            const resultCode = args.resultCode;
            const data = args.intent;
            // var _that = this;

            if (resultCode === android.app.Activity.RESULT_OK && requestCode === com.yalantis.ucrop.UCrop.REQUEST_CROP) {
              const resultUri: android.net.Uri = com.yalantis.ucrop.UCrop.getOutput(data);
              const is: ImageSource = new ImageSource();
              try {
                is.setNativeSource(android.graphics.BitmapFactory.decodeFile(resultUri.getPath()));
              } catch (e) {
                console.error(e);
              }
              ImageCropper._cleanFiles();
              application.android.off(application.AndroidApplication.activityResultEvent, onResult);
              if (is.android) {
                resolve({
                  response: "Success",
                  image: is,
                });
              } else {
                reject({
                  response: "Error",
                  image: null
                });
              }
              return;
            }
            else if (resultCode === android.app.Activity.RESULT_CANCELED && requestCode === com.yalantis.ucrop.UCrop.REQUEST_CROP) {
              ImageCropper._cleanFiles();
              application.android.off(application.AndroidApplication.activityResultEvent, onResult);
              resolve({
                response: "Cancelled",
                image: null
              });
              return;
            }
            else if (resultCode === com.yalantis.ucrop.UCrop.RESULT_ERROR) {
              ImageCropper._cleanFiles();
              const cropError: java.lang.Throwable = com.yalantis.ucrop.UCrop.getError(data);
              console.log(cropError.getMessage());
              application.android.off(application.AndroidApplication.activityResultEvent, onResult);
              reject({
                response: "Error",
                image: null
              });
              return;
            }
          };
开发者ID:bthurlow,项目名称:nativescript-imagecropper,代码行数:50,代码来源:imagecropper.android.ts

示例2: onUnloaded

export function onUnloaded(args) {
    console.log("back-button modal test unloaded");

    if (androidApp) {
        androidApp.off("activityBackPressed", activityBackPressedCallback);
    }
}
开发者ID:NathanWalker,项目名称:NativeScript,代码行数:7,代码来源:android-back-button-page.ts

示例3:

        app.android.on(app.AndroidApplication.activityRequestPermissionsEvent, (args: app.AndroidActivityRequestPermissionsEventData) => {
            if (permissions.hasPermission((android as any).Manifest.permission.CAMERA) && permissions.hasPermission((android as any).Manifest.permission.RECORD_AUDIO)) {
                this.startPreview();
                app.android.off(app.AndroidApplication.activityRequestPermissionsEvent);
            }

        });
开发者ID:triniwiz,项目名称:nativescript-videorecorder,代码行数:7,代码来源:advanced-video-view.android.ts

示例4: onUnloaded

 public onUnloaded(): void {
     if (this.nativeView && this.nativeView.release) {
         this.nativeView.release();
     }
     app.android.off(app.AndroidApplication.activityRequestPermissionsEvent);
     super.onUnloaded();
 }
开发者ID:triniwiz,项目名称:nativescript-videorecorder,代码行数:7,代码来源:advanced-video-view.android.ts

示例5: resolve

 const onActivityResult = (data: AndroidActivityResultEventData) => {
   if (data.requestCode === REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS) {
     if (data.resultCode === android.app.Activity.RESULT_OK) { // OK = -1
       // the user has just authenticated via the ConfirmDeviceCredential activity
       resolve();
     } else {
       // the user has quit the activity without providing credentials
       reject({
         code: ERROR_CODES.USER_CANCELLED,
         message: "User cancelled."
       });
     }
   }
   app.android.off(app.AndroidApplication.activityResultEvent, onActivityResult);
 };
开发者ID:EddyVerbruggen,项目名称:nativescript-touchid,代码行数:15,代码来源:fingerprint-auth.android.ts


注:本文中的tns-core-modules/application.android.off方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。