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

Java WXModuleAnno类代码示例

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

本文整理汇总了Java中com.taobao.weex.common.WXModuleAnno的典型用法代码示例。如果您正苦于以下问题:Java WXModuleAnno类的具体用法?Java WXModuleAnno怎么用?Java WXModuleAnno使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: setItem

import com.taobao.weex.common.WXModuleAnno; //导入依赖的package包/类
@Override
@WXModuleAnno
public void setItem(String key, String value, @Nullable final JSCallback callback) {
    if (TextUtils.isEmpty(key) || TextUtils.isEmpty(value)) {
        StorageResultHandler.handleInvalidParam(callback);
        return;
    }

    IWXStorageAdapter adapter = ability();
    if (adapter == null) {
        StorageResultHandler.handleNoHandlerError(callback);
        return;
    }
    adapter.setItem(key, value, new IWXStorageAdapter.OnResultReceivedListener() {
        @Override
        public void onReceived(Map<String, Object> data) {
            if(callback != null){
                callback.invoke(data);
            }
        }
    });


}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:25,代码来源:WXStorageModule.java


示例2: getItem

import com.taobao.weex.common.WXModuleAnno; //导入依赖的package包/类
@Override
@WXModuleAnno
public void getItem(String key, @Nullable final JSCallback callback) {
    if (TextUtils.isEmpty(key)) {
        StorageResultHandler.handleInvalidParam(callback);
        return;
    }

    IWXStorageAdapter adapter = ability();
    if (adapter == null) {
        StorageResultHandler.handleNoHandlerError(callback);
        return;
    }
    adapter.getItem(key, new IWXStorageAdapter.OnResultReceivedListener() {
        @Override
        public void onReceived(Map<String, Object> data) {
            if(callback != null){
                callback.invoke(data);
            }
        }
    });
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:23,代码来源:WXStorageModule.java


示例3: removeItem

import com.taobao.weex.common.WXModuleAnno; //导入依赖的package包/类
@Override
@WXModuleAnno
public void removeItem(String key, @Nullable final JSCallback callback) {
    if (TextUtils.isEmpty(key)) {
        StorageResultHandler.handleInvalidParam(callback);
        return;
    }

    IWXStorageAdapter adapter = ability();
    if (adapter == null) {
        StorageResultHandler.handleNoHandlerError(callback);
        return;
    }
    adapter.removeItem(key, new IWXStorageAdapter.OnResultReceivedListener() {
        @Override
        public void onReceived(Map<String, Object> data) {
            if(callback != null){
                callback.invoke(data);
            }
        }
    });
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:23,代码来源:WXStorageModule.java


示例4: length

import com.taobao.weex.common.WXModuleAnno; //导入依赖的package包/类
@Override
@WXModuleAnno
public void length(@Nullable final JSCallback callback) {
    IWXStorageAdapter adapter = ability();
    if (adapter == null) {
        StorageResultHandler.handleNoHandlerError(callback);
        return;
    }
    adapter.length(new IWXStorageAdapter.OnResultReceivedListener() {
        @Override
        public void onReceived(Map<String, Object> data) {
            if(callback != null){
                callback.invoke(data);
            }
        }
    });
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:18,代码来源:WXStorageModule.java


示例5: getAllKeys

import com.taobao.weex.common.WXModuleAnno; //导入依赖的package包/类
@Override
@WXModuleAnno
public void getAllKeys(@Nullable final JSCallback callback) {
    IWXStorageAdapter adapter = ability();
    if (adapter == null) {
        StorageResultHandler.handleNoHandlerError(callback);
        return;
    }
    adapter.getAllKeys(new IWXStorageAdapter.OnResultReceivedListener() {
        @Override
        public void onReceived(Map<String, Object> data) {
            if(callback != null){
                callback.invoke(data);
            }
        }
    });
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:18,代码来源:WXStorageModule.java


示例6: pop

import com.taobao.weex.common.WXModuleAnno; //导入依赖的package包/类
@WXModuleAnno
public void pop(String param, final String callbackId) {

    if (WXSDKEngine.getActivityNavBarSetter() != null) {
        if (WXSDKEngine.getActivityNavBarSetter().pop(param)) {
            WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
                    MSG_SUCCESS);
            return;
        }
    }

    if (mWXSDKInstance.getContext() instanceof Activity) {
        WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
                                               MSG_SUCCESS);
        ((Activity) mWXSDKInstance.getContext()).finish();
    }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:18,代码来源:WXNavigatorModule.java


示例7: setNavBarLeftItem

import com.taobao.weex.common.WXModuleAnno; //导入依赖的package包/类
@WXModuleAnno
public void setNavBarLeftItem(String param, final String callbackId) {
    if (!TextUtils.isEmpty(param)) {
        if (WXSDKEngine.getActivityNavBarSetter() != null) {
            if (WXSDKEngine.getActivityNavBarSetter().setNavBarLeftItem(param)) {
                WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
                        MSG_SUCCESS);
                return;
            }
        }
    }

    WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
            MSG_FAILED);

}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:17,代码来源:WXNavigatorModule.java


示例8: getString

import com.taobao.weex.common.WXModuleAnno; //导入依赖的package包/类
@Override
@WXModuleAnno
public void getString(@Nullable JSCallback callback) {
    Context context = mWXSDKInstance.getContext();
    ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);

    Map<String, Object> map = new HashMap<>(2);
    ClipData clip = clipboard.getPrimaryClip();
    if (clip != null && clip.getItemCount() > 0) {
        ClipData.Item item = clip.getItemAt(0);
        CharSequence text = coerceToText(context, item);

        map.put(RESULT, text != null ? RESULT_OK : RESULT_FAILED);
        map.put(DATA, text != null ? text : "");
    } else {
        map.put(RESULT, RESULT_FAILED);
        map.put(DATA, "");
    }

    if (null != callback) {
        callback.invoke(map);
    }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:24,代码来源:WXClipboardModule.java


示例9: openURL

import com.taobao.weex.common.WXModuleAnno; //导入依赖的package包/类
@WXModuleAnno(moduleMethod = true,runOnUIThread = true)
public void openURL(String url) {
  if (TextUtils.isEmpty(url)) {
    return;
  }
  String scheme = Uri.parse(url).getScheme();
  StringBuilder builder = new StringBuilder();
  if (TextUtils.equals("http",scheme) || TextUtils.equals("https",scheme) || TextUtils.equals("file",scheme)) {
    builder.append(url);
  } else {
    builder.append("http:");
    builder.append(url);
  }

  Uri uri = Uri.parse(builder.toString());
  Intent intent = new Intent(Intent.ACTION_VIEW, uri);
  intent.addCategory(WEEX_CATEGORY);
  mWXSDKInstance.getContext().startActivity(intent);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:20,代码来源:WXEventModule.java


示例10: scrollToElement

import com.taobao.weex.common.WXModuleAnno; //导入依赖的package包/类
/**
 * Scroll the specified {@link WXDomObject} to given offset in given duration
 * @param ref {@link WXDomObject#ref} of specified dom object
 * @param options scroll option, like {offset:0, duration:300}
 */
@WXModuleAnno(moduleMethod = true, runOnUIThread = false)
public void scrollToElement(String ref, JSONObject options) {
  if (TextUtils.isEmpty(ref) || options == null) {
    return;
  }

  Message msg = Message.obtain();
  WXDomTask task = new WXDomTask();
  task.instanceId = mWXSDKInstance.getInstanceId();
  task.args = new ArrayList<>();
  task.args.add(ref);
  task.args.add(options);
  msg.what = WXDomHandler.MsgType.WX_DOM_SCROLLTO;
  msg.obj = task;
  WXSDKManager.getInstance().getWXDomManager().sendMessage(msg);
}
 
开发者ID:Laisly,项目名称:weex,代码行数:22,代码来源:WXDomModule.java


示例11: setNavBarLeftItem

import com.taobao.weex.common.WXModuleAnno; //导入依赖的package包/类
@WXModuleAnno
public void setNavBarLeftItem(String param, final String callbackId) {
    if (!TextUtils.isEmpty(param)) {
        if (WXSDKEngine.getActivityNavBarSetter() != null) {
            if (WXSDKEngine.getActivityNavBarSetter().setNavBarLeftItem(param)) {
                WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
                        WXConst.MSG_SUCCESS);
                return;
            }
        }
    }

    WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
            WXConst.MSG_FAILED);

}
 
开发者ID:Laisly,项目名称:weex,代码行数:17,代码来源:WXNavigatorModule.java


示例12: updateAttrs

import com.taobao.weex.common.WXModuleAnno; //导入依赖的package包/类
/**
 * Update {@link WXDomObject#attr}
 * @param ref {@link WXDomObject#ref}
 * @param attr the expected attr
 */
@WXModuleAnno(moduleMethod = true, runOnUIThread = false)
public void updateAttrs(String ref, JSONObject attr) {
  if (TextUtils.isEmpty(ref) || attr == null || attr.size() < 1) {
    return;
  }
  Message msg = Message.obtain();
  WXDomTask task = new WXDomTask();
  task.instanceId = mWXSDKInstance.getInstanceId();
  task.args = new ArrayList<>();
  task.args.add(ref);
  task.args.add(attr);
  msg.what = WXDomHandler.MsgType.WX_DOM_UPDATE_ATTRS;
  msg.obj = task;
  WXSDKManager.getInstance().getWXDomManager().sendMessage(msg);
}
 
开发者ID:Laisly,项目名称:weex,代码行数:21,代码来源:WXDomModule.java


示例13: updateStyle

import com.taobao.weex.common.WXModuleAnno; //导入依赖的package包/类
/**
 * Update {@link WXDomObject#style}
 * @param ref {@link WXDomObject#ref}
 * @param style the expected style
 */
@WXModuleAnno(moduleMethod = true, runOnUIThread = false)
public void updateStyle(String ref, JSONObject style) {
  if (TextUtils.isEmpty(ref) || style == null || style.size() < 1) {
    return;
  }
  Message msg = Message.obtain();
  WXDomTask task = new WXDomTask();
  task.instanceId = mWXSDKInstance.getInstanceId();
  task.args = new ArrayList<>();
  task.args.add(ref);
  task.args.add(style);
  msg.what = WXDomHandler.MsgType.WX_DOM_UPDATE_STYLE;
  msg.obj = task;
  WXSDKManager.getInstance().getWXDomManager().sendMessage(msg);
}
 
开发者ID:Laisly,项目名称:weex,代码行数:21,代码来源:WXDomModule.java


示例14: addElement

import com.taobao.weex.common.WXModuleAnno; //导入依赖的package包/类
/**
 * Add a {@link WXDomObject} to the specified parent as its given n-th child.
 * @param parentRef {@link WXDomObject#ref} of the parent.
 * @param element the node to be added
 * @param index the expected index that the new dom in its new parent
 */
@WXModuleAnno(moduleMethod = true, runOnUIThread = false)
public void addElement(String parentRef, JSONObject element, Integer index) {
  if (element == null
      || TextUtils.isEmpty(parentRef)) {
    return;
  }
  Message msg = Message.obtain();
  WXDomTask task = new WXDomTask();
  task.instanceId = mWXSDKInstance.getInstanceId();
  task.args = new ArrayList<>();
  task.args.add(parentRef);
  task.args.add(element);
  task.args.add(index);
  msg.what = WXDomHandler.MsgType.WX_DOM_ADD_DOM;
  msg.obj = task;
  WXSDKManager.getInstance().getWXDomManager().sendMessage(msg);
}
 
开发者ID:Laisly,项目名称:weex,代码行数:24,代码来源:WXDomModule.java


示例15: moveElement

import com.taobao.weex.common.WXModuleAnno; //导入依赖的package包/类
/**
 * Move the DomElement to the specified parent as its given n-th child.
 * @param ref {@link WXDomObject#ref} of the node to be moved.
 * @param parentRef {@link WXDomObject#ref} of the parent.
 * @param index the expected index that the dom in its new parent
 */
@WXModuleAnno(moduleMethod = true, runOnUIThread = false)
public void moveElement(String ref, String parentRef, Integer index) {
  if (TextUtils.isEmpty(ref)
      || TextUtils.isEmpty(parentRef)) {
    return;
  }
  Message msg = Message.obtain();
  WXDomTask task = new WXDomTask();
  task.instanceId = mWXSDKInstance.getInstanceId();
  task.args = new ArrayList<>();
  task.args.add(ref);
  task.args.add(parentRef);
  task.args.add(index);
  msg.what = WXDomHandler.MsgType.WX_DOM_MOVE_DOM;
  msg.obj = task;
  WXSDKManager.getInstance().getWXDomManager().sendMessage(msg);
}
 
开发者ID:Laisly,项目名称:weex,代码行数:24,代码来源:WXDomModule.java


示例16: removeEvent

import com.taobao.weex.common.WXModuleAnno; //导入依赖的package包/类
/**
 * Remove eventListener for the specified {@link WXDomObject}
 * @param ref {@link WXDomObject#ref} of the node
 * @param type the type of the event listener to be removed.
 */
@WXModuleAnno(moduleMethod = true, runOnUIThread = false)
public void removeEvent(String ref, String type) {
  if (TextUtils.isEmpty(ref) || TextUtils.isEmpty(type)) {
    return;
  }
  Message msg = Message.obtain();
  WXDomTask task = new WXDomTask();
  task.instanceId = mWXSDKInstance.getInstanceId();
  task.args = new ArrayList<>();
  task.args.add(ref);
  task.args.add(type);
  msg.what = WXDomHandler.MsgType.WX_DOM_REMOVE_EVENT;
  msg.obj = task;
  WXSDKManager.getInstance().getWXDomManager().sendMessage(msg);
}
 
开发者ID:Laisly,项目名称:weex,代码行数:21,代码来源:WXDomModule.java


示例17: generateMethodMap

import com.taobao.weex.common.WXModuleAnno; //导入依赖的package包/类
private void generateMethodMap() {
  WXLogUtils.d(TAG, "extractMethodNames");
  ArrayList<String> methods = new ArrayList<>();
  HashMap<String, Invoker> methodMap = new HashMap<>();
  try {
    for (Method method : mClazz.getMethods()) {
      // iterates all the annotations available in the method
      for (Annotation anno : method.getDeclaredAnnotations()) {
        if (anno != null && anno instanceof WXModuleAnno) {
          methods.add(method.getName());
          methodMap.put(method.getName(), new MethodInvoker(method));
          break;
        }
      }
    }
  } catch (Throwable e) {
    WXLogUtils.e("[WXModuleManager] extractMethodNames:" + e.getStackTrace());
  }
  mMethods = methods;
  mMethodMap = methodMap;
}
 
开发者ID:Laisly,项目名称:weex,代码行数:22,代码来源:TypeModuleFactory.java


示例18: openURL

import com.taobao.weex.common.WXModuleAnno; //导入依赖的package包/类
@WXModuleAnno(moduleMethod = true,runOnUIThread = true)
public void openURL(String url) {
  if (TextUtils.isEmpty(url)) {
    return;
  }
  Intent intent = new Intent(Intent.ACTION_VIEW);
  Uri uri = Uri.parse(url);
  String scheme = uri.getScheme();

  if (TextUtils.equals("tel", scheme)) {

  } else if (TextUtils.equals("sms", scheme)) {

  } else if (TextUtils.equals("mailto", scheme)) {

  } else if (TextUtils.equals("http", scheme) ||
      TextUtils.equals("https",
      scheme)) {
    intent.putExtra("isLocal", false);
    intent.addCategory(WEEX_CATEGORY);
  } else if (TextUtils.equals("file", scheme)) {
    intent.putExtra("isLocal", true);
    intent.addCategory(WEEX_CATEGORY);
  } else {
    intent.addCategory(WEEX_CATEGORY);
    uri = Uri.parse(new StringBuilder("http:").append(url).toString());
  }

  intent.setData(uri);
  mWXSDKInstance.getContext().startActivity(intent);
}
 
开发者ID:wangwei123,项目名称:my-weex,代码行数:32,代码来源:WXEventModule.java


示例19: openURL

import com.taobao.weex.common.WXModuleAnno; //导入依赖的package包/类
@WXModuleAnno(moduleMethod = true,runOnUIThread = true)
public void openURL(String url) {
  if (TextUtils.isEmpty(url)) {
    return;
  }
  Intent intent = new Intent(Intent.ACTION_VIEW);
  Uri uri = Uri.parse(url);
  String scheme = uri.getScheme();

  if (TextUtils.equals("tel", scheme)) {

  } else if (TextUtils.equals("sms", scheme)) {

  } else if (TextUtils.equals("mailto", scheme)) {

  } else if (TextUtils.equals("http", scheme) ||
      TextUtils.equals("https",
      scheme)) {
    intent.putExtra("isLocal", false);
    intent.addCategory(WEEX_CATEGORY);
  } else if (TextUtils.equals("file", scheme)) {
    intent.putExtra("isLocal", true);
    intent.addCategory(WEEX_CATEGORY);
  } else {
    intent.addCategory(WEEX_CATEGORY);
    uri = Uri.parse(new StringBuilder("http:").append(url).toString());
  }

  intent.setData(uri);
  intent.setClass(mWXSDKInstance.getContext(), WXPageActivity.class);
  mWXSDKInstance.getContext().startActivity(intent);
}
 
开发者ID:coderminer,项目名称:GankIO_weex,代码行数:33,代码来源:WXEventModule.java


示例20: push

import com.taobao.weex.common.WXModuleAnno; //导入依赖的package包/类
@WXModuleAnno
public void push(String param, final String callbackId) {

    if (!TextUtils.isEmpty(param)) {
        if (WXSDKEngine.getActivityNavBarSetter() != null) {
            if (WXSDKEngine.getActivityNavBarSetter().push(param)) {
                WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
                        MSG_SUCCESS);
                return;
            }
        }

        try {
            JSONObject jsonObject = new JSONObject(param);
            String url = jsonObject.optString(URL, "");
            if (!TextUtils.isEmpty(url)) {
                Uri rawUri = Uri.parse(url);
                String scheme = rawUri.getScheme();
                Uri.Builder builder = rawUri.buildUpon();
                if (TextUtils.isEmpty(scheme)) {
                    builder.scheme("http");
                }
                Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
                intent.addCategory(WEEX);
                intent.putExtra(INSTANCE_ID, mWXSDKInstance.getInstanceId());
                mWXSDKInstance.getContext().startActivity(intent);
                WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
                        MSG_SUCCESS);
            }
        } catch (Exception e) {
            WXLogUtils.eTag(TAG, e);
            WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
                    MSG_FAILED);
        }
    }

    WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
            MSG_FAILED);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:40,代码来源:WXNavigatorModule.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ThreadPoolProfile类代码示例发布时间:2022-05-22
下一篇:
Java PlayerInventory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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