Search in sources :

Example 21 with CommentListBean

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

the class MainCommentsTimeLineDao method getGSONMsgListWithoutClearUnread.

public CommentListBean getGSONMsgListWithoutClearUnread() throws WeiboException {
    String url = getUrl();
    Map<String, String> map = new HashMap<String, String>();
    map.put("access_token", access_token);
    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);
    map.put("filter_by_source", filter_by_source);
    String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map);
    Gson gson = new Gson();
    CommentListBean value = null;
    try {
        value = gson.fromJson(jsonData, CommentListBean.class);
    } catch (JsonSyntaxException e) {
        AppLogger.e(e.getMessage());
    }
    if (value != null && value.getSize() > 0) {
        List<CommentBean> msgList = value.getItemList();
        Iterator<CommentBean> iterator = msgList.iterator();
        while (iterator.hasNext()) {
            CommentBean msg = iterator.next();
            if (msg.getUser() == null) {
                iterator.remove();
            } else {
                msg.getListViewSpannableString();
                TimeUtility.dealMills(msg);
            }
        }
    }
    return value;
}
Also used : JsonSyntaxException(com.google.gson.JsonSyntaxException) HashMap(java.util.HashMap) Gson(com.google.gson.Gson) CommentListBean(org.qii.weiciyuan.bean.CommentListBean) CommentBean(org.qii.weiciyuan.bean.CommentBean)

Example 22 with CommentListBean

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

the class CommentsTimeLineByIdDao method getGSONMsgList.

public CommentListBean getGSONMsgList() throws WeiboException {
    String url = URLHelper.COMMENTS_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();
    CommentListBean value = null;
    try {
        value = gson.fromJson(jsonData, CommentListBean.class);
    } catch (JsonSyntaxException e) {
        AppLogger.e(e.getMessage());
    }
    if (value != null && value.getItemList().size() > 0) {
        List<CommentBean> msgList = value.getItemList();
        Iterator<CommentBean> iterator = msgList.iterator();
        while (iterator.hasNext()) {
            CommentBean msg = iterator.next();
            if (msg.getUser() == null) {
                iterator.remove();
            } else {
                msg.getListViewSpannableString();
                TimeUtility.dealMills(msg);
            }
        }
    }
    return value;
}
Also used : JsonSyntaxException(com.google.gson.JsonSyntaxException) HashMap(java.util.HashMap) Gson(com.google.gson.Gson) CommentListBean(org.qii.weiciyuan.bean.CommentListBean) CommentBean(org.qii.weiciyuan.bean.CommentBean)

Aggregations

CommentListBean (org.qii.weiciyuan.bean.CommentListBean)22 CommentBean (org.qii.weiciyuan.bean.CommentBean)7 CommentTimeLineData (org.qii.weiciyuan.bean.android.CommentTimeLineData)7 Gson (com.google.gson.Gson)6 JsonSyntaxException (com.google.gson.JsonSyntaxException)6 MessageListBean (org.qii.weiciyuan.bean.MessageListBean)5 ArrayList (java.util.ArrayList)4 UnreadBean (org.qii.weiciyuan.bean.UnreadBean)4 Cursor (android.database.Cursor)3 HashMap (java.util.HashMap)3 TimeLinePosition (org.qii.weiciyuan.bean.android.TimeLinePosition)3 AccountBean (org.qii.weiciyuan.bean.AccountBean)2 MainCommentsTimeLineDao (org.qii.weiciyuan.dao.maintimeline.MainCommentsTimeLineDao)2 MentionsCommentTimeLineDao (org.qii.weiciyuan.dao.maintimeline.MentionsCommentTimeLineDao)2 Notification (android.app.Notification)1 NotificationManager (android.app.NotificationManager)1 PendingIntent (android.app.PendingIntent)1 Context (android.content.Context)1 Intent (android.content.Intent)1 IntentFilter (android.content.IntentFilter)1