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; }
public List<TagBean> getGSONMsgList() throws WeiboException { String json = getMsgListJson(); List<TagBean> tagBeanList = new ArrayList<TagBean>(); try { JSONArray array = new JSONArray(json); int size = array.length(); for (int i = 0; i < size; i++) { TagBean bean = new TagBean(); JSONObject jsonObject = array.getJSONObject(i); Iterator<String> iterator = jsonObject.keys(); while (iterator.hasNext()) { String key = iterator.next(); if (key.equalsIgnoreCase("weight")) { String value = jsonObject.optString(key); bean.setWeight(value); } else { String value = jsonObject.optString(key); bean.setId(Integer.valueOf(key)); bean.setName(value); } } tagBeanList.add(bean); } } catch (JSONException e) { AppLogger.e(e.getMessage()); } return tagBeanList; }
@Override protected DBResult doInBackground(String... params) { String token = params[0]; long expiresInSeconds = Long.valueOf(params[1]); try { UserBean user = new OAuthDao(token).getOAuthUserInfo(); AccountBean account = new AccountBean(); account.setAccess_token(token); account.setExpires_time(System.currentTimeMillis() + expiresInSeconds * 1000); account.setInfo(user); AppLogger.e("token expires in " + Utility.calcTokenExpiresInDays(account) + " days"); return AccountDBTask.addOrUpdateAccount(account, false); } catch (WeiboException e) { AppLogger.e(e.getError()); this.e = e; cancel(true); return null; } }
public List<MessageReCmtCountBean> get() throws WeiboException { String json = getJson(); List<MessageReCmtCountBean> value = null; try { value = new Gson().fromJson(json, new TypeToken<List<MessageReCmtCountBean>>() {}.getType()); } catch (JsonSyntaxException e) { AppLogger.e(e.getMessage()); } return value; }
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; }
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; }
public boolean destroy() throws WeiboException { String url = URLHelper.GROUP_DESTROY; Map<String, String> map = new HashMap<String, String>(); map.put("access_token", access_token); map.put("list_id", list_id); String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map); Gson gson = new Gson(); Result value = null; try { value = gson.fromJson(jsonData, Result.class); } catch (JsonSyntaxException e) { AppLogger.e(e.getMessage()); } return (value != null); }