use of com.google.gson.JsonSyntaxException in project weiciyuan by qii.
the class MentionsWeiboTimeLineDao method getGSONMsgListWithoutClearUnread.
public MessageListBean getGSONMsgListWithoutClearUnread() throws WeiboException {
String json = getMsgListJson();
Gson gson = new Gson();
MessageListBean value = null;
try {
value = gson.fromJson(json, MessageListBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
/**
* sometime sina weibo may delete message,so data don't have any user information
*/
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.JsonSyntaxException in project weiciyuan by qii.
the class FriendshipsDao method executeTask.
private UserBean executeTask(String url) throws WeiboException {
if (TextUtils.isEmpty(uid) && TextUtils.isEmpty(screen_name)) {
AppLogger.e("uid or screen name can't be empty");
return null;
}
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
if (!TextUtils.isEmpty(uid)) {
map.put("uid", uid);
} else {
map.put("screen_name", screen_name);
}
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map);
try {
UserBean value = new Gson().fromJson(jsonData, UserBean.class);
if (value != null) {
return value;
}
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
return null;
}
use of com.google.gson.JsonSyntaxException in project weiciyuan by qii.
the class SearchDao method getStatusList.
public SearchStatusListBean getStatusList() throws WeiboException {
String url = URLHelper.STATUSES_SEARCH;
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("count", count);
map.put("page", page);
map.put("q", q);
String jsonData = null;
jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map);
Gson gson = new Gson();
SearchStatusListBean value = null;
try {
value = gson.fromJson(jsonData, SearchStatusListBean.class);
List<MessageBean> list = value.getItemList();
Iterator<MessageBean> iterator = list.iterator();
while (iterator.hasNext()) {
MessageBean msg = iterator.next();
//message is deleted by sina
if (msg.getUser() == null) {
iterator.remove();
} else {
msg.getListViewSpannableString();
TimeUtility.dealMills(msg);
}
}
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
return value;
}
use of com.google.gson.JsonSyntaxException in project weiciyuan by qii.
the class CommentNewMsgDao method sendNewMsg.
public CommentBean sendNewMsg() throws WeiboException {
String url = URLHelper.COMMENT_CREATE;
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("id", id);
map.put("comment", comment);
map.put("comment_ori", comment_ori);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map);
Gson gson = new Gson();
CommentBean value = null;
try {
value = gson.fromJson(jsonData, CommentBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
return value;
}
use of com.google.gson.JsonSyntaxException in project weiciyuan by qii.
the class ReplyToCommentMsgDao method reply.
public CommentBean reply() throws WeiboException {
String url = URLHelper.COMMENT_REPLY;
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("id", id);
map.put("cid", cid);
map.put("comment", comment);
map.put("comment_ori", comment_ori);
map.put("without_mention", without_mention);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map);
Gson gson = new Gson();
CommentBean value = null;
try {
value = gson.fromJson(jsonData, CommentBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
return value;
}
Aggregations