Search in sources :

Example 1 with MessageBean

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

Example 2 with MessageBean

use of org.qii.weiciyuan.bean.MessageBean 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 3 with MessageBean

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

the class SearchTopicDao method getGSONMsgList.

public TopicResultListBean getGSONMsgList() throws WeiboException {
    String json = getMsgListJson();
    Gson gson = new Gson();
    TopicResultListBean value = null;
    try {
        value = gson.fromJson(json, TopicResultListBean.class);
    } catch (JsonSyntaxException e) {
        AppLogger.e(e.getMessage());
        return null;
    }
    if (value != null && value.getStatuses() != null && value.getStatuses().size() > 0) {
        List<MessageBean> msgList = value.getStatuses();
        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;
}
Also used : MessageBean(org.qii.weiciyuan.bean.MessageBean) JsonSyntaxException(com.google.gson.JsonSyntaxException) TopicResultListBean(org.qii.weiciyuan.bean.TopicResultListBean) Gson(com.google.gson.Gson)

Example 4 with MessageBean

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

the class ShareShortUrlTimeLineDao method getGSONMsgList.

public ShareListBean getGSONMsgList() throws WeiboException {
    String json = getMsgListJson();
    Gson gson = new Gson();
    ShareListBean value = null;
    try {
        value = gson.fromJson(json, ShareListBean.class);
    } catch (JsonSyntaxException e) {
        AppLogger.e(e.getMessage());
    }
    if (value != null) {
        Iterator<MessageBean> iterator = value.getItemList().iterator();
        while (iterator.hasNext()) {
            MessageBean msg = iterator.next();
            if (msg.getUser() == null) {
                iterator.remove();
            } else {
                msg.getListViewSpannableString();
                TimeUtility.dealMills(msg);
            }
        }
    }
    return value;
}
Also used : MessageBean(org.qii.weiciyuan.bean.MessageBean) JsonSyntaxException(com.google.gson.JsonSyntaxException) ShareListBean(org.qii.weiciyuan.bean.ShareListBean) Gson(com.google.gson.Gson)

Example 5 with MessageBean

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

the class RepostsTimeLineByIdDao method getGSONMsgList.

public RepostListBean getGSONMsgList() throws WeiboException {
    String url = URLHelper.REPOSTS_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();
    RepostListBean value = null;
    try {
        value = gson.fromJson(jsonData, RepostListBean.class);
    } catch (JsonSyntaxException e) {
        AppLogger.e(e.getMessage());
    }
    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;
}
Also used : MessageBean(org.qii.weiciyuan.bean.MessageBean) JsonSyntaxException(com.google.gson.JsonSyntaxException) RepostListBean(org.qii.weiciyuan.bean.RepostListBean) HashMap(java.util.HashMap) Gson(com.google.gson.Gson)

Aggregations

MessageBean (org.qii.weiciyuan.bean.MessageBean)52 Gson (com.google.gson.Gson)21 JsonSyntaxException (com.google.gson.JsonSyntaxException)16 ArrayList (java.util.ArrayList)9 HashMap (java.util.HashMap)8 MessageListBean (org.qii.weiciyuan.bean.MessageListBean)8 Cursor (android.database.Cursor)7 Intent (android.content.Intent)6 CommentBean (org.qii.weiciyuan.bean.CommentBean)6 UserBean (org.qii.weiciyuan.bean.UserBean)6 DatabaseUtils (android.database.DatabaseUtils)4 SQLException (android.database.SQLException)4 View (android.view.View)4 PendingIntent (android.app.PendingIntent)3 Drawable (android.graphics.drawable.Drawable)3 SpannableString (android.text.SpannableString)3 AbsListView (android.widget.AbsListView)3 ListView (android.widget.ListView)3 RelativeLayout (android.widget.RelativeLayout)3 TextView (android.widget.TextView)3