• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript utils.ad类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中tns-core-modules/utils/utils.ad的典型用法代码示例。如果您正苦于以下问题:TypeScript ad类的具体用法?TypeScript ad怎么用?TypeScript ad使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: getPlaceholderImageDrawable

  public static getPlaceholderImageDrawable(value) {

    let fileName = "",
      drawable = null;


    if (types.isString(value)) {

      value = value.trim();

      if (utils.isFileOrResourcePath(value)) {


        if (0 === value.indexOf("~/")) {
          fileName = fs.path.join(fs.knownFolders.currentApp().path, value.replace("~/", ""));
          drawable = android.graphics.drawable.Drawable.createFromPath(fileName);
        } else if (0 === value.indexOf("res")) {
          fileName = value;
          let res = utils.ad.getApplicationContext().getResources();
          let resName = fileName.substr(utils.RESOURCE_PREFIX.length);
          let identifier = res.getIdentifier(resName, 'drawable', utils.ad.getApplication().getPackageName());
          drawable = res.getDrawable(identifier);
        }


      }
    }

    return drawable;

  }
开发者ID:VideoSpike,项目名称:nativescript-web-image-cache,代码行数:31,代码来源:helpers.ts


示例2: Promise

    return new Promise((resolve, reject) => {
      try {
        if (!this.keyguardManager || !this.keyguardManager.isKeyguardSecure()) {
          resolve({
            any: false
          });
          return;
        }

        // The fingerprint API is only available from Android 6.0 (M, Api level 23)
        if (android.os.Build.VERSION.SDK_INT < 23) {
          reject(`Your api version doesn't support fingerprint authentication`);
          return;
        }

        const fingerprintManager = utils.ad.getApplicationContext().getSystemService("fingerprint");
        if (!fingerprintManager.isHardwareDetected()) {
          // Device doesn't support fingerprint authentication
          reject(`Device doesn't support fingerprint authentication`);
        } else if (!fingerprintManager.hasEnrolledFingerprints()) {
          // User hasn't enrolled any fingerprints to authenticate with
          reject(`User hasn't enrolled any fingerprints to authenticate with`);
        } else {
          resolve({
            any: true,
            touch: true
          });
        }
      } catch (ex) {
        console.log(`fingerprint-auth.available: ${ex}`);
        reject(ex);
      }
    });
开发者ID:EddyVerbruggen,项目名称:nativescript-touchid,代码行数:33,代码来源:fingerprint-auth.android.ts


示例3: setSource

  static setSource(image, value) {
    image.nativeView.setImageURI(null, null);

    if (types.isString(value)) {
      value = value.trim();
      if (utils.isFileOrResourcePath(value) || 0 === value.indexOf("http")) {
        image.isLoading = true;
        let fileName = "";
        if (0 === value.indexOf("~/")) {
          fileName = fs.path.join(fs.knownFolders.currentApp().path, value.replace("~/", ""));
          fileName = "file:" + fileName;
        } else if (0 === value.indexOf("res")) {
          fileName = value;
          let res = utils.ad.getApplicationContext().getResources();
          let resName = fileName.substr(utils.RESOURCE_PREFIX.length);
          let identifier = res.getIdentifier(resName, 'drawable', utils.ad.getApplication().getPackageName());
          fileName = "res:/" + identifier;
        } else if (0 === value.indexOf("http")) {
          image.isLoading = true;
          fileName = value;
        }

        image.nativeView.setImageURI(android.net.Uri.parse(fileName), null);

        let controllerListener = new ProxyBaseControllerListener();
        controllerListener.setNSCachedImage(image);


        let controller = com.facebook.drawee.backends.pipeline.Fresco.newDraweeControllerBuilder()
          .setControllerListener(controllerListener)
          .setUri(android.net.Uri.parse(fileName))
          .build();
        image.nativeView.setController(controller);
        image.requestLayout();

      } else {

        throw new Error("Path \"" + "\" is not a valid file or resource.");

      }
    }

  }
开发者ID:VideoSpike,项目名称:nativescript-web-image-cache,代码行数:43,代码来源:helpers.ts


示例4:

        actions.map((action, i) => {
          const intent = new android.content.Intent(application.android.context, application.android.foregroundActivity.getClass());
          intent.setAction(SHORTCUT_PREFIX + action.type);

          const shortcutBuilder = new android.content.pm.ShortcutInfo.Builder(application.android.context, `id${i}`)
              .setShortLabel(action.title)
              .setLongLabel(action.title) // TODO add property some day
              .setIntent(intent);

          if (action.iconTemplate) {
            let res = ad.getApplicationContext().getResources();
            let identifier = res.getIdentifier(action.iconTemplate, "drawable", ad.getApplication().getPackageName());
            if (identifier === 0) {
              console.log(`No icon found for this device density for icon '${action.iconTemplate}'. Falling back to the default icon.`);
            } else {
              shortcutBuilder.setIcon(android.graphics.drawable.Icon.createWithResource(application.android.context, identifier));
            }
          }
          shortcuts.add(shortcutBuilder.build());
        });
开发者ID:EddyVerbruggen,项目名称:nativescript-3dtouch,代码行数:20,代码来源:app-shortcuts.android.ts


示例5: if

    p.on(placeholderModule.Placeholder.creatingViewEvent, (args: placeholderModule.CreateViewEventData) => {
        let nativeView;
        if (isIOS) {
            nativeView = UITextView.new();
            nativeView.text = "Native";
        } else if (isAndroid) {
            nativeView = new android.widget.TextView(utils.ad.getApplicationContext());
            nativeView.setText("Native");
        }

        args.view = nativeView;
    });
开发者ID:NathanWalker,项目名称:NativeScript,代码行数:12,代码来源:placeholder-tests.ts


示例6: creatingView

function creatingView(args) {
    let nativeView;
    if (isIOS) {
        nativeView = UITextView.new();
        nativeView.text = "Native";
    } else if (isAndroid) {
        nativeView = new android.widget.TextView(utils.ad.getApplicationContext());
        nativeView.setText("Native");
    }

    args.view = nativeView;
}
开发者ID:NathanWalker,项目名称:NativeScript,代码行数:12,代码来源:placeholder-tests.ts


示例7:

 navigationButton.on("tap", (args: EventData) => {
     ad.dismissSoftInput();
     this.routerExtensions.backToPreviousPage();
 });
开发者ID:telerik,项目名称:nativescript-ui-samples-angular,代码行数:4,代码来源:toggle-nav-button.directive.ts


示例8: constructor

 constructor() {
   this.keyguardManager = utils.ad.getApplicationContext().getSystemService("keyguard");
 }
开发者ID:EddyVerbruggen,项目名称:nativescript-touchid,代码行数:3,代码来源:fingerprint-auth.android.ts


示例9: hideKeyboard

export function hideKeyboard() {
    if (isAndroid) {
        ad.dismissSoftInput();
    }
}
开发者ID:NathanWalker,项目名称:NativeScript,代码行数:5,代码来源:issue-2942.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript utils.ios类代码示例发布时间:2022-05-25
下一篇:
TypeScript utils.isFileOrResourcePath函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap