use of com.google.gson.Gson in project weiciyuan by qii.
the class ModifyGroupMemberDao method executeTask.
private UserBean executeTask(String url) throws WeiboException {
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("uid", uid);
map.put("list_id", list_id);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map);
Gson gson = new Gson();
UserBean value = null;
try {
value = gson.fromJson(jsonData, UserBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
return value;
}
use of com.google.gson.Gson in project weiciyuan by qii.
the class UpdateGroupNameDao method update.
public GroupBean update() throws WeiboException {
String url = URLHelper.GROUP_UPDATE;
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("name", name);
map.put("list_id", list_id);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map);
Gson gson = new Gson();
GroupBean value = null;
try {
value = gson.fromJson(jsonData, GroupBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
return value;
}
use of com.google.gson.Gson in project weiciyuan by qii.
the class StatusesTimeLineDao method getGSONMsgList.
public MessageListBean getGSONMsgList() throws WeiboException {
String url = URLHelper.STATUSES_TIMELINE_BY_ID;
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("uid", uid);
map.put("since_id", since_id);
map.put("max_id", max_id);
map.put("count", count);
map.put("page", page);
map.put("screen_name", screen_name);
map.put("base_app", base_app);
map.put("feature", feature);
map.put("trim_user", trim_user);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map);
Gson gson = new Gson();
MessageListBean value = null;
try {
value = gson.fromJson(jsonData, MessageListBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
if (value != null && value.getSize() > 0) {
for (MessageBean b : value.getItemList()) {
TimeUtility.dealMills(b);
TimeLineUtility.addJustHighLightLinks(b);
}
}
return value;
}
use of com.google.gson.Gson in project weiciyuan by qii.
the class AccountDBTask method updateMyProfile.
public static void updateMyProfile(AccountBean account, UserBean value) {
String uid = account.getUid();
String json = new Gson().toJson(value);
ContentValues cv = new ContentValues();
cv.put(AccountTable.UID, uid);
cv.put(AccountTable.INFOJSON, json);
int c = getWsd().update(AccountTable.TABLE_NAME, cv, AccountTable.UID + "=?", new String[] { uid });
}
use of com.google.gson.Gson in project weiciyuan by qii.
the class AtUsersDBTask method get.
public static List<AtUserBean> get(SQLiteDatabase db, String accountId) {
List<AtUserBean> msgList = new ArrayList<AtUserBean>();
String sql = "select * from " + AtUsersTable.TABLE_NAME + " where " + AtUsersTable.ACCOUNTID + " = " + accountId + " order by " + AtUsersTable.ID + " desc";
Cursor c = db.rawQuery(sql, null);
Gson gson = new Gson();
while (c.moveToNext()) {
String json = c.getString(c.getColumnIndex(AtUsersTable.JSONDATA));
try {
AtUserBean value = gson.fromJson(json, AtUserBean.class);
msgList.add(value);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
}
c.close();
return msgList;
}
Aggregations