use of com.google.gson.Gson in project weiciyuan by qii.
the class RepostsTimeLineByIdDao method getGSONMsgList.
public RepostListBean getGSONMsgList() throws WeiboException {
String url = URLHelper.REPOSTS_TIMELINE_BY_MSGID;
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("id", id);
map.put("since_id", since_id);
map.put("max_id", max_id);
map.put("count", count);
map.put("page", page);
map.put("filter_by_author", filter_by_author);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map);
Gson gson = new Gson();
RepostListBean value = null;
try {
value = gson.fromJson(jsonData, RepostListBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
if (value != null && value.getItemList().size() > 0) {
List<MessageBean> msgList = value.getItemList();
Iterator<MessageBean> iterator = msgList.iterator();
while (iterator.hasNext()) {
MessageBean msg = iterator.next();
if (msg.getUser() == null) {
iterator.remove();
} else {
msg.getListViewSpannableString();
TimeUtility.dealMills(msg);
}
}
}
return value;
}
use of com.google.gson.Gson in project weiciyuan by qii.
the class DestroyStatusDao method destroy.
public boolean destroy() throws WeiboException {
String url = URLHelper.STATUSES_DESTROY;
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("id", id);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map);
Gson gson = new Gson();
try {
MessageBean value = gson.fromJson(jsonData, MessageBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
return false;
}
return true;
}
use of com.google.gson.Gson in project weiciyuan by qii.
the class DMConversationDao method getConversationList.
public DMListBean getConversationList() throws WeiboException {
String url = URLHelper.DM_CONVERSATION;
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("uid", uid);
map.put("page", page);
map.put("count", count);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map);
DMListBean value = null;
try {
value = new Gson().fromJson(jsonData, DMListBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
return value;
}
use of com.google.gson.Gson in project weiciyuan by qii.
the class FavDao method executeTask.
private FavBean executeTask(String url) throws WeiboException {
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("id", id);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map);
try {
FavBean value = new Gson().fromJson(jsonData, FavBean.class);
if (value != null) {
return value;
}
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
return null;
}
use of com.google.gson.Gson in project weiciyuan by qii.
the class GroupListDao method getInfo.
public List<String> getInfo() throws WeiboException {
String url = URLHelper.GROUP_MEMBER_LIST;
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("uids", uids);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map);
Gson gson = new Gson();
List<GroupUser> value = null;
try {
value = gson.fromJson(jsonData, new TypeToken<List<GroupUser>>() {
}.getType());
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
if (value != null && value.size() > 0) {
GroupUser user = value.get(0);
List<String> ids = new ArrayList<String>();
for (GroupBean b : user.lists) {
ids.add(b.getIdstr());
}
return ids;
}
return null;
}
Aggregations