Search in sources :

Example 1 with SearchStatusListBean

use of org.qii.weiciyuan.bean.SearchStatusListBean 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;
}
Also used : MessageBean(org.qii.weiciyuan.bean.MessageBean) JsonSyntaxException(com.google.gson.JsonSyntaxException) HashMap(java.util.HashMap) Gson(com.google.gson.Gson) SearchStatusListBean(org.qii.weiciyuan.bean.SearchStatusListBean)

Example 2 with SearchStatusListBean

use of org.qii.weiciyuan.bean.SearchStatusListBean in project weiciyuan by qii.

the class SearchStatusLoader method loadData.

public SearchStatusListBean loadData() throws WeiboException {
    SearchDao dao = new SearchDao(token, searchWord);
    dao.setPage(page);
    SearchStatusListBean result = null;
    lock.lock();
    try {
        result = dao.getStatusList();
    } finally {
        lock.unlock();
    }
    return result;
}
Also used : SearchDao(org.qii.weiciyuan.dao.search.SearchDao) SearchStatusListBean(org.qii.weiciyuan.bean.SearchStatusListBean)

Aggregations

SearchStatusListBean (org.qii.weiciyuan.bean.SearchStatusListBean)2 Gson (com.google.gson.Gson)1 JsonSyntaxException (com.google.gson.JsonSyntaxException)1 HashMap (java.util.HashMap)1 MessageBean (org.qii.weiciyuan.bean.MessageBean)1 SearchDao (org.qii.weiciyuan.dao.search.SearchDao)1