本文整理汇总了Java中com.taobao.weex.bridge.JSCallback类的典型用法代码示例。如果您正苦于以下问题:Java JSCallback类的具体用法?Java JSCallback怎么用?Java JSCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JSCallback类属于com.taobao.weex.bridge包,在下文中一共展示了JSCallback类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getComponentSize
import com.taobao.weex.bridge.JSCallback; //导入依赖的package包/类
public void getComponentSize(final String ref, final JSCallback callback) {
if (mDestroy) {
Map<String, Object> options = new HashMap<>();
options.put("result", false);
options.put("errMsg", "Component does not exist");
callback.invoke(options);
return;
}
mNormalTasks.add(new IWXRenderTask() {
@Override
public void execute() {
mWXRenderManager.getComponentSize(mInstanceId, ref, callback);
}
@Override
public String toString() {
return "getComponentSize";
}
});
mDirty=true;
}
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:25,代码来源:WXDomStatement.java
示例2: getAllKeys
import com.taobao.weex.bridge.JSCallback; //导入依赖的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
示例3: setNavBarRightItem
import com.taobao.weex.bridge.JSCallback; //导入依赖的package包/类
@JSMethod(uiThread = true)
public void setNavBarRightItem(String param, JSCallback callback) {
if (!TextUtils.isEmpty(param)) {
if (WXSDKEngine.getActivityNavBarSetter() != null) {
if (WXSDKEngine.getActivityNavBarSetter().setNavBarRightItem(param)) {
if (callback != null) {
callback.invoke(MSG_SUCCESS);
}
return;
}
}
}
if (callback != null) {
callback.invoke(MSG_FAILED);
}
}
开发者ID:natjs,项目名称:nat-explorer,代码行数:18,代码来源:NavigatorModule.java
示例4: setNavBarLeftItem
import com.taobao.weex.bridge.JSCallback; //导入依赖的package包/类
@JSMethod(uiThread = true)
public void setNavBarLeftItem(String param, JSCallback callback) {
if (!TextUtils.isEmpty(param)) {
if (WXSDKEngine.getActivityNavBarSetter() != null) {
if (WXSDKEngine.getActivityNavBarSetter().setNavBarLeftItem(param)) {
if (callback != null) {
callback.invoke(MSG_SUCCESS);
}
return;
}
}
}
if (callback != null) {
callback.invoke(MSG_FAILED);
}
}
开发者ID:natjs,项目名称:nat-explorer,代码行数:19,代码来源:NavigatorModule.java
示例5: sendRequest
import com.taobao.weex.bridge.JSCallback; //导入依赖的package包/类
private void sendRequest(Options options,ResponseCallback callback,JSCallback progressCallback){
WXRequest wxRequest = new WXRequest();
wxRequest.method = options.getMethod();
wxRequest.url = mWXSDKInstance.rewriteUri(Uri.parse(options.getUrl()), URIAdapter.REQUEST).toString();
wxRequest.body = options.getBody();
wxRequest.timeoutMs = options.getTimeout();
if(options.getHeaders()!=null)
if (wxRequest.paramMap == null) {
wxRequest.paramMap = options.getHeaders();
}else{
wxRequest.paramMap.putAll(options.getHeaders());
}
IWXHttpAdapter adapter = ( mAdapter==null && mWXSDKInstance != null) ? mWXSDKInstance.getWXHttpAdapter() : mAdapter;
if (adapter != null) {
adapter.sendRequest(wxRequest, new StreamHttpListener(callback,progressCallback));
}else{
WXLogUtils.e("WXStreamModule","No HttpAdapter found,request failed.");
}
}
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:23,代码来源:WXStreamModule.java
示例6: setNavBarTitle
import com.taobao.weex.bridge.JSCallback; //导入依赖的package包/类
@JSMethod(uiThread = true)
public void setNavBarTitle(String param, JSCallback callback) {
if (!TextUtils.isEmpty(param)) {
if (WXSDKEngine.getActivityNavBarSetter() != null) {
if (WXSDKEngine.getActivityNavBarSetter().setNavBarTitle(param)) {
if (callback != null) {
callback.invoke(MSG_SUCCESS);
}
return;
}
}
}
if (callback != null) {
callback.invoke(MSG_FAILED);
}
}
开发者ID:natjs,项目名称:nat-explorer,代码行数:17,代码来源:NavigatorModule.java
示例7: captureImage
import com.taobao.weex.bridge.JSCallback; //导入依赖的package包/类
@JSMethod
public void captureImage(HashMap<String, Object> param, final JSCallback jsCallback){
boolean b = PermissionChecker.lacksPermissions(mWXSDKInstance.getContext(), Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (b) {
HashMap<String, String> dialog = new HashMap<>();
dialog.put("title", "权限申请");
dialog.put("message", "请允许拍照");
PermissionChecker.requestPermissions((Activity) mWXSDKInstance.getContext(), dialog, new com.nat.permission.ModuleResultListener() {
@Override
public void onResult(Object o) {
if ((boolean)o == true) jsCallback.invoke(Util.getError(Constant.CAMERA_PERMISSION_DENIED, Constant.CAMERA_PERMISSION_DENIED_CODE));
}
}, Constant.CAMERA_PERMISSION_REQUEST_CODE, Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE);
} else {
realCaptureImage(param, jsCallback);
}
}
开发者ID:natjs,项目名称:nat-explorer,代码行数:18,代码来源:Camera.java
示例8: captureVideo
import com.taobao.weex.bridge.JSCallback; //导入依赖的package包/类
@JSMethod
public void captureVideo(HashMap<String, Object> param, final JSCallback jsCallback){
boolean b = PermissionChecker.lacksPermissions(mWXSDKInstance.getContext(), Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (b) {
HashMap<String, String> dialog = new HashMap<>();
dialog.put("title", "权限申请");
dialog.put("message", "请允许录像");
PermissionChecker.requestPermissions((Activity) mWXSDKInstance.getContext(), dialog, new com.nat.permission.ModuleResultListener() {
@Override
public void onResult(Object o) {
if ((boolean)o == true) jsCallback.invoke(Util.getError(Constant.CAMERA_PERMISSION_DENIED, Constant.CAMERA_PERMISSION_DENIED_CODE));
}
}, Constant.CAMERA_PERMISSION_REQUEST_CODE, Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE);
} else {
realCaptureVideo(param, jsCallback);
}
}
开发者ID:natjs,项目名称:nat-explorer,代码行数:18,代码来源:Camera.java
示例9: call
import com.taobao.weex.bridge.JSCallback; //导入依赖的package包/类
@JSMethod
public void call(String number, final JSCallback jsCallback){
boolean permAllow = PermissionChecker.lacksPermission(mWXSDKInstance.getContext(), Manifest.permission.CALL_PHONE);
if (permAllow) {
HashMap<String, String> dialog = new HashMap<>();
dialog.put("title", "权限申请");
dialog.put("message", "请允许拨打电话");
mCallNumber = number;
mCallCallback = jsCallback;
PermissionChecker.requestPermissions((Activity) mWXSDKInstance.getContext(), dialog, new com.nat.permission.ModuleResultListener() {
@Override
public void onResult(Object o) {
if ((boolean)o == true) jsCallback.invoke(Util.getError(Constant.CALL_PHONE_PERMISSION_DENIED, Constant.CALL_PHONE_PERMISSION_DENIED_CODE));
}
}, Constant.CALL_PHONE_PERMISSION_REQUEST_CODE, Manifest.permission.CALL_PHONE);
} else {
realCall(number, jsCallback);
}
}
开发者ID:natjs,项目名称:nat-explorer,代码行数:23,代码来源:Communication.java
示例10: getString
import com.taobao.weex.bridge.JSCallback; //导入依赖的package包/类
@Override
@JSMethod
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:weexext,项目名称:ucar-weex-core,代码行数:24,代码来源:WXClipboardModule.java
示例11: getAllKeys
import com.taobao.weex.bridge.JSCallback; //导入依赖的package包/类
@Override
@JSMethod(uiThread = false)
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:weexext,项目名称:ucar-weex-core,代码行数:18,代码来源:WXStorageModule.java
示例12: getItem
import com.taobao.weex.bridge.JSCallback; //导入依赖的package包/类
@Override
@JSMethod(uiThread = false)
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:weexext,项目名称:ucar-weex-core,代码行数:23,代码来源:WXStorageModule.java
示例13: close
import com.taobao.weex.bridge.JSCallback; //导入依赖的package包/类
@JSMethod(uiThread = true)
public void close(JSONObject options, JSCallback success, JSCallback failure) {
JSONObject result = new JSONObject();
JSCallback callback = null;
if (mWXSDKInstance.getContext() instanceof Activity) {
callback = success;
((Activity) mWXSDKInstance.getContext()).finish();
} else {
result.put(CALLBACK_RESULT, MSG_FAILED);
result.put(CALLBACK_MESSAGE, "Close page failed.");
callback = failure;
}
if (callback != null) {
callback.invoke(result);
}
}
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:17,代码来源:WXNavigatorModule.java
示例14: getItem
import com.taobao.weex.bridge.JSCallback; //导入依赖的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
示例15: pick
import com.taobao.weex.bridge.JSCallback; //导入依赖的package包/类
@JSMethod
public void pick(HashMap<String, Object> param, final JSCallback jsCallback){
mPickCallback = jsCallback;
mPickParam = param;
boolean b = PermissionChecker.lacksPermissions(mWXSDKInstance.getContext(), Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (b) {
HashMap<String, String> dialog = new HashMap<>();
dialog.put("title", "权限申请");
dialog.put("message", "请允许打开相机,相册");
PermissionChecker.requestPermissions((Activity) mWXSDKInstance.getContext(), dialog, new com.nat.permission.ModuleResultListener() {
@Override
public void onResult(Object o) {
if (o != null && o.toString().equals("true")) {
jsCallback.invoke(Util.getError(Constant.CAMERA_PERMISSION_DENIED, Constant.CAMERA_PERMISSION_DENIED_CODE));
}
}
}, PICK_REQUEST_CODE, Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE);
} else {
ImageModule.getInstance(mWXSDKInstance.getContext()).pick((Activity) mWXSDKInstance.getContext(), param);
}
}
开发者ID:natjs,项目名称:nat-explorer,代码行数:23,代码来源:Image.java
示例16: pop
import com.taobao.weex.bridge.JSCallback; //导入依赖的package包/类
@JSMethod(uiThread = true)
public void pop(String param, JSCallback callback) {
if (WXSDKEngine.getActivityNavBarSetter() != null) {
if (WXSDKEngine.getActivityNavBarSetter().pop(param)) {
if (callback != null) {
callback.invoke(MSG_SUCCESS);
}
return;
}
}
if (mWXSDKInstance.getContext() instanceof Activity) {
if (callback != null) {
callback.invoke(MSG_SUCCESS);
}
((Activity) mWXSDKInstance.getContext()).finish();
}
}
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:20,代码来源:UWXNavigatorModule2.java
示例17: getComponentSize
import com.taobao.weex.bridge.JSCallback; //导入依赖的package包/类
public void getComponentSize(String ref, JSCallback callback) {
WXComponent component = mRegistry.get(ref);
Map<String, Object> options = new HashMap<>();
if (component != null) {
Map<String, String> size = new HashMap<>();
Rect sizes = component.getComponentSize();
size.put("width", String.valueOf(WXViewUtils.getWebPxByWidth(sizes.width(),mWXSDKInstance.getViewPortWidth())));
size.put("height", String.valueOf(WXViewUtils.getWebPxByWidth(sizes.height(),mWXSDKInstance.getViewPortWidth())));
size.put("bottom",String.valueOf(WXViewUtils.getWebPxByWidth(sizes.bottom,mWXSDKInstance.getViewPortWidth())));
size.put("left",String.valueOf(WXViewUtils.getWebPxByWidth(sizes.left,mWXSDKInstance.getViewPortWidth())));
size.put("right",String.valueOf(WXViewUtils.getWebPxByWidth(sizes.right,mWXSDKInstance.getViewPortWidth())));
size.put("top",String.valueOf(WXViewUtils.getWebPxByWidth(sizes.top,mWXSDKInstance.getViewPortWidth())));
options.put("size", size);
options.put("result", true);
} else {
options.put("errMsg", "Component does not exist");
}
callback.invoke(options);
}
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:20,代码来源:WXRenderStatement.java
示例18: start
import com.taobao.weex.bridge.JSCallback; //导入依赖的package包/类
@JSMethod
public void start(HashMap<String, String> params, final JSCallback jsCallback){
boolean permAllow = PermissionChecker.lacksPermissions(mWXSDKInstance.getContext(), Manifest.permission.RECORD_AUDIO, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (permAllow) {
HashMap<String, String> dialog = new HashMap<>();
dialog.put("title", "权限申请");
dialog.put("message", "请允许音频录制");
mCallParams = params;
mCallCallback = jsCallback;
PermissionChecker.requestPermissions((Activity) mWXSDKInstance.getContext(), dialog, new com.nat.permission.ModuleResultListener() {
@Override
public void onResult(Object o) {
if ((boolean)o == true) jsCallback.invoke(Util.getError(Constant.RECORD_AUDIO_PERMISSION_DENIED, Constant.RECORD_AUDIO_PERMISSION_DENIED_CODE));
}
}, Constant.RECORD_AUDIO_PERMISSION_REQUEST_CODE, Manifest.permission.RECORD_AUDIO, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE);
} else {
realRecord(params, jsCallback);
}
}
开发者ID:natjs,项目名称:nat-explorer,代码行数:23,代码来源:Recorder.java
示例19: length
import com.taobao.weex.bridge.JSCallback; //导入依赖的package包/类
@Override
@JSMethod(uiThread = false)
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:weexext,项目名称:ucar-weex-core,代码行数:18,代码来源:WXStorageModule.java
示例20: getString
import com.taobao.weex.bridge.JSCallback; //导入依赖的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
注:本文中的com.taobao.weex.bridge.JSCallback类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论