Search in sources :

Example 96 with JSMethod

use of com.taobao.weex.annotation.JSMethod in project WeexErosFramework by bmfe.

the class WebSocketModule method close.

@JSMethod
public void close(String code, String reason) {
    if (!reportErrorIfNoAdapter()) {
        Log.e(TAG, "close>>>>>>" + reason);
        int codeNumber = WebSocketCloseCodes.CLOSE_NORMAL.getCode();
        if (code != null) {
            try {
                codeNumber = Integer.parseInt(code);
            } catch (NumberFormatException e) {
            // ignore
            }
        }
        LightlyWebSocketAdapter bmWebSocketAdapter = (LightlyWebSocketAdapter) webSocketAdapter;
        bmWebSocketAdapter.close(codeNumber, reason, mWXSDKInstance.getInstanceId());
    }
}
Also used : LightlyWebSocketAdapter(com.eros.framework.extend.adapter.LightlyWebSocketAdapter) JSMethod(com.taobao.weex.annotation.JSMethod)

Example 97 with JSMethod

use of com.taobao.weex.annotation.JSMethod in project WeexErosFramework by bmfe.

the class WebSocketModule method send.

@JSMethod
public void send(String data) {
    Log.e(TAG, "send>>>>>>" + data + this);
    if (!reportErrorIfNoAdapter()) {
        LightlyWebSocketAdapter bmWebSocketAdapter = (LightlyWebSocketAdapter) webSocketAdapter;
        bmWebSocketAdapter.send(data, mWXSDKInstance.getInstanceId());
    }
}
Also used : LightlyWebSocketAdapter(com.eros.framework.extend.adapter.LightlyWebSocketAdapter) JSMethod(com.taobao.weex.annotation.JSMethod)

Example 98 with JSMethod

use of com.taobao.weex.annotation.JSMethod in project WeexErosFramework by bmfe.

the class CommunicationModule method sms.

@JSMethod
public void sms(String recipients, String params, JSCallback callback) {
    WeexEventBean weexEventBean = new WeexEventBean();
    weexEventBean.setKey(WXEventCenter.EVENT_COMMUNICATION_SMS);
    weexEventBean.setContext(mWXSDKInstance.getContext());
    weexEventBean.setJsParams(params);
    weexEventBean.setJscallback(callback);
    weexEventBean.setExpand(recipients);
    ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(weexEventBean);
}
Also used : WeexEventBean(com.eros.framework.model.WeexEventBean) JSMethod(com.taobao.weex.annotation.JSMethod)

Example 99 with JSMethod

use of com.taobao.weex.annotation.JSMethod in project WeexErosFramework by bmfe.

the class ModalModule method toast.

@JSMethod(uiThread = true)
public void toast(String options) {
    WeexEventBean eventBean = new WeexEventBean();
    eventBean.setContext(mWXSDKInstance.getContext());
    eventBean.setKey(WXEventCenter.EVENT_MODAL_TOAST);
    eventBean.setJsParams(options);
    ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(eventBean);
}
Also used : WeexEventBean(com.eros.framework.model.WeexEventBean) JSMethod(com.taobao.weex.annotation.JSMethod)

Example 100 with JSMethod

use of com.taobao.weex.annotation.JSMethod in project WeexErosFramework by bmfe.

the class StorageModule method getData.

@JSMethod(uiThread = true)
public Object getData(String key, JSCallback callback) {
    WeexEventBean weexEventBean = new WeexEventBean();
    weexEventBean.setKey(WXEventCenter.EVENT_GETDATA);
    weexEventBean.setContext(mWXSDKInstance.getContext());
    ArrayList<String> list = new ArrayList();
    list.add(key);
    weexEventBean.setParamsList(list);
    weexEventBean.setJscallback(callback);
    ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(weexEventBean);
    return null;
}
Also used : WeexEventBean(com.eros.framework.model.WeexEventBean) ArrayList(java.util.ArrayList) JSMethod(com.taobao.weex.annotation.JSMethod)

Aggregations

JSMethod (com.taobao.weex.annotation.JSMethod)198 WeexEventBean (com.eros.framework.model.WeexEventBean)53 WeexEventBean (com.benmu.framework.model.WeexEventBean)50 JSONObject (com.alibaba.fastjson.JSONObject)32 ArrayList (java.util.ArrayList)25 HashMap (java.util.HashMap)20 Intent (android.content.Intent)19 JSCallback (com.taobao.weex.bridge.JSCallback)12 Activity (android.app.Activity)11 WXEditText (com.taobao.weex.ui.view.WXEditText)8 Map (java.util.Map)8 Uri (android.net.Uri)7 AlertDialog (android.app.AlertDialog)6 Context (android.content.Context)6 DialogInterface (android.content.DialogInterface)6 OnClickListener (android.content.DialogInterface.OnClickListener)6 EditText (android.widget.EditText)6 JSONException (com.alibaba.fastjson.JSONException)6 Invoker (com.taobao.weex.bridge.Invoker)5 MethodInvoker (com.taobao.weex.bridge.MethodInvoker)5