use of com.taobao.weex.annotation.JSMethod in project weex-example by KalicyZhou.
the class WXServiceModule method fetch.
@JSMethod(uiThread = true)
public void fetch(Map params, final JSCallback callback) {
this.jsCallback = callback;
Map attr = (Map) params.get("attr");
attr.put("datatype", "json/xml");
BXDataManager.getInstance().st.getServiceAgent().callService(JSON.toJSONString(params), this, "fetchCallBack");
}
use of com.taobao.weex.annotation.JSMethod in project weex-example by KalicyZhou.
the class SyncTestModule method getObject.
/**
* JSON NOT allow KeyValue as non-string value
* @return
*/
@JSMethod(uiThread = false)
public Object getObject() {
ArrayList list = new ArrayList();
list.add("222");
list.add("test");
Map map = new HashMap();
map.put(11, "test11");
map.put("22", "test22");
list.add(map);
return list;
}
use of com.taobao.weex.annotation.JSMethod in project weex-example by KalicyZhou.
the class SyncTestModule method getArray.
@JSMethod(uiThread = false)
public ArrayList getArray() {
ArrayList list = new ArrayList();
list.add("ArrayList test 1");
list.add("ArrayList test 2");
return list;
}
use of com.taobao.weex.annotation.JSMethod in project weex-example by KalicyZhou.
the class WXEventModule method openURL.
@JSMethod(uiThread = 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(WEEX_ACTION, uri);
intent.addCategory(WEEX_CATEGORY);
mWXSDKInstance.getContext().startActivity(intent);
if (mWXSDKInstance.checkModuleEventRegistered("event", this)) {
HashMap<String, Object> params = new HashMap<>();
params.put("param1", "param1");
params.put("param2", "param2");
params.put("param3", "param3");
mWXSDKInstance.fireModuleEvent("event", this, params);
}
}
use of com.taobao.weex.annotation.JSMethod in project WeexErosFramework by bmfe.
the class AppConfigModule method changeFontSize.
@JSMethod(uiThread = false)
public void changeFontSize(String options, JSCallback jsCallback) {
initFontSize();
if (options == null) {
JsPoster.postSuccess(mFontSizeBean, jsCallback);
return;
}
Object obj = ManagerFactory.getManagerService(ParseManager.class).parseObject(options).get("fontSize");
if (obj != null && obj instanceof String) {
String fontSize = (String) obj;
if (fontSize.equals(mFontSizeBean.fontSize)) {
JsPoster.postSuccess(mFontSizeBean, jsCallback);
return;
}
mFontSizeBean.fontSize = fontSize;
Intent intent = new Intent(Constant.Action.ACTION_GOBALFONTSIZE_CHANGE);
intent.putExtra("currentFontSize", fontSize);
LocalBroadcastManager.getInstance(mWXSDKInstance.getContext()).sendBroadcast(intent);
SharePreferenceUtil.setAppFontSizeOption(mWXSDKInstance.getContext(), fontSize);
}
JsPoster.postSuccess(mFontSizeBean, jsCallback);
}
Aggregations