Search in sources :

Example 46 with MessageBean

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

the class StatusesByIdTimeLineFragment method onActivityResult.

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (data == null) {
        return;
    }
    MessageBean msg = (MessageBean) data.getParcelableExtra("msg");
    if (msg != null) {
        for (int i = 0; i < getList().getSize(); i++) {
            if (msg.equals(getList().getItem(i))) {
                getList().getItem(i).setReposts_count(msg.getReposts_count());
                getList().getItem(i).setComments_count(msg.getComments_count());
                break;
            }
        }
        getAdapter().notifyDataSetChanged();
    }
}
Also used : MessageBean(org.qii.weiciyuan.bean.MessageBean)

Example 47 with MessageBean

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

the class BrowserWeiboMsgFragment method buildRepostCount.

private void buildRepostCount() {
    MessageBean repostBean = msg.getRetweeted_status();
    if (repostBean.getComments_count() == 0 && repostBean.getReposts_count() == 0) {
        layout.count_layout.setVisibility(View.GONE);
        return;
    } else {
        layout.count_layout.setVisibility(View.VISIBLE);
    }
    if (repostBean.getComments_count() > 0) {
        layout.comment_count.setVisibility(View.VISIBLE);
        layout.comment_count.setText(String.valueOf(repostBean.getComments_count()));
    } else {
        layout.comment_count.setVisibility(View.GONE);
    }
    if (repostBean.getReposts_count() > 0) {
        layout.repost_count.setVisibility(View.VISIBLE);
        layout.repost_count.setText(String.valueOf(repostBean.getReposts_count()));
    } else {
        layout.repost_count.setVisibility(View.GONE);
    }
}
Also used : MessageBean(org.qii.weiciyuan.bean.MessageBean)

Example 48 with MessageBean

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

the class FavListDao method getGSONMsgList.

public FavListBean getGSONMsgList() throws WeiboException {
    String json = getMsgListJson();
    Gson gson = new Gson();
    FavListBean value = null;
    try {
        value = gson.fromJson(json, FavListBean.class);
    } catch (JsonSyntaxException e) {
        AppLogger.e(e.getMessage());
    }
    if (value != null) {
        List<MessageBean> msgList = new ArrayList<MessageBean>();
        int size = value.getFavorites().size();
        for (int i = 0; i < size; i++) {
            msgList.add(value.getFavorites().get(i).getStatus());
        }
        Iterator<FavBean> iterator = value.getFavorites().iterator();
        while (iterator.hasNext()) {
            FavBean msg = iterator.next();
            if (msg.getStatus().getUser() == null) {
                iterator.remove();
            } else {
                msg.getStatus().getListViewSpannableString();
                TimeUtility.dealMills(msg.getStatus());
            }
        }
    }
    return value;
}
Also used : MessageBean(org.qii.weiciyuan.bean.MessageBean) JsonSyntaxException(com.google.gson.JsonSyntaxException) FavBean(org.qii.weiciyuan.bean.FavBean) FavListBean(org.qii.weiciyuan.bean.FavListBean) ArrayList(java.util.ArrayList) Gson(com.google.gson.Gson)

Example 49 with MessageBean

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

the class RepostNewMsgDao method sendNewMsg.

public MessageBean sendNewMsg() throws WeiboException {
    String url = URLHelper.REPOST_CREATE;
    Map<String, String> map = new HashMap<String, String>();
    map.put("access_token", access_token);
    map.put("id", id);
    map.put("status", status);
    map.put("is_comment", is_comment);
    String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map);
    Gson gson = new Gson();
    MessageBean value = null;
    try {
        value = gson.fromJson(jsonData, MessageBean.class);
    } 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)

Example 50 with MessageBean

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

the class ShowStatusDao method getMsg.

public MessageBean getMsg() throws WeiboException {
    String url = URLHelper.STATUSES_SHOW;
    Map<String, String> map = new HashMap<String, String>();
    map.put("access_token", access_token);
    map.put("id", id);
    String json = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map);
    Gson gson = new Gson();
    MessageBean value = null;
    try {
        value = gson.fromJson(json, MessageBean.class);
    } 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)

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