Search in sources :

Example 11 with JSONObject

use of com.alibaba.fastjson.JSONObject in project ride-read-android by Ride-Read.

the class MsgUtils method addMsgInfo.

public static void addMsgInfo(UserBaseInfo user, String msg, long time) {
    JSONObject msgUserJson = getMsgUserObj();
    if (null == msgUserJson)
        msgUserJson = new JSONObject();
    MsgInfo msginfo = new MsgInfo(user, msg, time);
    String key = Integer.toString(user.getUid());
    if (msgUserJson.containsKey(key))
        msgUserJson.remove(key);
    msgUserJson.put(key, msginfo);
    saveMsgUserList(msgUserJson);
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) MsgInfo(com.rideread.rideread.data.been.MsgInfo)

Example 12 with JSONObject

use of com.alibaba.fastjson.JSONObject in project ride-read-android by Ride-Read.

the class MsgActivity method refreshMsgUserList.

private void refreshMsgUserList() {
    JSONObject msgsJson = MsgUtils.getMsgUserObj();
    if (null != msgsJson) {
        Set<String> keySet = msgsJson.keySet();
        Iterator keyCursor = keySet.iterator();
        String key;
        mMsgInfoList.clear();
        while (keyCursor.hasNext()) {
            key = (String) keyCursor.next();
            mMsgInfoList.add(msgsJson.getObject(key, MsgInfo.class));
            mMsgUserAdapter.notifyDataSetChanged();
        }
    }
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) MsgInfo(com.rideread.rideread.data.been.MsgInfo) Iterator(java.util.Iterator)

Example 13 with JSONObject

use of com.alibaba.fastjson.JSONObject in project weex-example by KalicyZhou.

the class WXComponent method updateStyleByPesudo.

private void updateStyleByPesudo(Map<String, Object> styles) {
    Message message = Message.obtain();
    WXDomTask task = new WXDomTask();
    task.instanceId = getInstanceId();
    task.args = new ArrayList<>();
    JSONObject styleJson = new JSONObject(styles);
    task.args.add(getRef());
    task.args.add(styleJson);
    //flag pesudo
    task.args.add(true);
    message.obj = task;
    message.what = WXDomHandler.MsgType.WX_DOM_UPDATE_STYLE;
    WXSDKManager.getInstance().getWXDomManager().sendMessage(message);
}
Also used : Message(android.os.Message) WXDomTask(com.taobao.weex.dom.WXDomTask) JSONObject(com.alibaba.fastjson.JSONObject)

Example 14 with JSONObject

use of com.alibaba.fastjson.JSONObject in project weex-example by KalicyZhou.

the class WXDomStatementTest method testRemoveDom.

@Test
public void testRemoveDom() throws Exception {
    createBody();
    JSONObject obj;
    obj = new JSONObject();
    obj.put("type", "div");
    obj.put("ref", "100");
    stmt.addDom(obj, WXDomObject.ROOT, 0);
    obj = new JSONObject();
    obj.put("type", "div");
    obj.put("ref", "101");
    stmt.addDom(obj, WXDomObject.ROOT, 0);
    stmt.removeDom("101");
    stmt.batch();
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) WXBridgeManagerTest(com.taobao.weex.bridge.WXBridgeManagerTest) Test(org.junit.Test) WXSDKInstanceTest(com.taobao.weex.WXSDKInstanceTest)

Example 15 with JSONObject

use of com.alibaba.fastjson.JSONObject in project weex-example by KalicyZhou.

the class WXDomStatementTest method createBody.

void createBody() {
    JSONObject body = new JSONObject();
    body.put("type", "div");
    body.put("ref", WXDomObject.ROOT);
    stmt.createBody(body);
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject)

Aggregations

JSONObject (com.alibaba.fastjson.JSONObject)1750 HashMap (java.util.HashMap)302 JSONArray (com.alibaba.fastjson.JSONArray)279 Test (org.junit.Test)217 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)182 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)165 IOException (java.io.IOException)138 ArrayList (java.util.ArrayList)125 Map (java.util.Map)111 AuthPassport (com.ngtesting.platform.util.AuthPassport)96 UserVo (com.ngtesting.platform.vo.UserVo)76 Date (java.util.Date)76 List (java.util.List)72 File (java.io.File)70 UnitResponse (info.xiancloud.core.message.UnitResponse)61 JSONException (com.alibaba.fastjson.JSONException)46 StringEntity (org.apache.http.entity.StringEntity)46 HttpResponse (org.apache.http.HttpResponse)44 Header (org.apache.http.Header)36 DefaultJSONParser (com.alibaba.fastjson.parser.DefaultJSONParser)30