use of com.google.gson.Gson in project weiciyuan by qii.
the class NearbyTimeLineDao method get.
public NearbyStatusListBean get() throws WeiboException {
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("lat", lat);
map.put("long", long_fix);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, URLHelper.NEARBY_STATUS, map);
try {
NearbyStatusListBean value = new Gson().fromJson(jsonData, NearbyStatusListBean.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 OAuthDao method getOAuthUserInfo.
public UserBean getOAuthUserInfo() throws WeiboException {
String uidJson = getOAuthUserUIDJsonData();
String uid = "";
try {
JSONObject jsonObject = new JSONObject(uidJson);
uid = jsonObject.optString("uid");
} catch (JSONException e) {
AppLogger.e(e.getMessage());
}
Map<String, String> map = new HashMap<String, String>();
map.put("uid", uid);
map.put("access_token", access_token);
String url = URLHelper.USER_SHOW;
String result = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map);
Gson gson = new Gson();
UserBean user = new UserBean();
try {
user = gson.fromJson(result, UserBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(result);
}
return user;
}
use of com.google.gson.Gson in project weiciyuan by qii.
the class FriendGroupDao method getGroup.
public GroupListBean getGroup() throws WeiboException {
String url = URLHelper.FRIENDSGROUP_INFO;
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map);
Gson gson = new Gson();
GroupListBean value = null;
try {
value = gson.fromJson(jsonData, GroupListBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
return value;
}
use of com.google.gson.Gson in project weiciyuan by qii.
the class FriendGroupTimeLineDao method getGSONMsgList.
public MessageListBean getGSONMsgList() 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());
return null;
}
if (value != null && value.getItemList().size() > 0) {
TimeLineUtility.filterMessage(value);
}
return value;
}
use of com.google.gson.Gson 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;
}
Aggregations