Search in sources :

Example 1 with DMUserBean

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

the class DMUserListAdapter method bindViewData.

protected void bindViewData(DMViewHolder holder, int position) {
    final DMUserBean msg = bean.get(position);
    UserBean user = msg.getUser();
    if (user != null) {
        holder.username.setVisibility(View.VISIBLE);
        buildUsername(holder, user);
        buildAvatar(holder.avatar, position, user);
    } else {
        holder.username.setVisibility(View.INVISIBLE);
        holder.avatar.setVisibility(View.INVISIBLE);
    }
    if (!TextUtils.isEmpty(msg.getListViewSpannableString())) {
        holder.content.setText(msg.getListViewSpannableString());
    } else {
        TimeLineUtility.addJustHighLightLinks(msg);
        holder.content.setText(msg.getListViewSpannableString());
    }
    bindOnTouchListener(holder);
    String time = msg.getListviewItemShowTime();
    if (!holder.time.getText().toString().equals(time)) {
        holder.time.setText(time);
    }
    holder.time.setTag(msg.getId());
}
Also used : DMUserBean(org.qii.weiciyuan.bean.DMUserBean) UserBean(org.qii.weiciyuan.bean.UserBean) DMUserBean(org.qii.weiciyuan.bean.DMUserBean)

Example 2 with DMUserBean

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

the class DMDBTask method get.

public static DMUserListBean get(String accountId) {
    Gson gson = new Gson();
    DMUserListBean result = new DMUserListBean();
    String sql = "select * from " + DMTable.TABLE_NAME + " where " + DMTable.ACCOUNTID + "  = " + accountId + " order by " + DMTable.MBLOGID + " desc limit 1";
    Cursor c = getRsd().rawQuery(sql, null);
    while (c.moveToNext()) {
        String json = c.getString(c.getColumnIndex(DMTable.JSONDATA));
        try {
            DMUserListBean value = gson.fromJson(json, DMUserListBean.class);
            for (DMUserBean b : value.getItemList()) {
                if (!b.isMiddleUnreadItem()) {
                    b.getListViewSpannableString();
                    b.getListviewItemShowTime();
                }
            }
            return value;
        } catch (JsonSyntaxException ignored) {
        }
    }
    c.close();
    return result;
}
Also used : DMUserBean(org.qii.weiciyuan.bean.DMUserBean) JsonSyntaxException(com.google.gson.JsonSyntaxException) DMUserListBean(org.qii.weiciyuan.bean.DMUserListBean) Gson(com.google.gson.Gson) Cursor(android.database.Cursor)

Example 3 with DMUserBean

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

the class DMDao method getUserList.

public DMUserListBean getUserList() throws WeiboException {
    String url = URLHelper.DM_USERLIST;
    Map<String, String> map = new HashMap<String, String>();
    map.put("access_token", access_token);
    map.put("count", count);
    map.put("cursor", cursor);
    String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map);
    DMUserListBean value = null;
    try {
        value = new Gson().fromJson(jsonData, DMUserListBean.class);
        for (DMUserBean b : value.getItemList()) {
            if (!b.isMiddleUnreadItem()) {
                b.getListViewSpannableString();
                b.getListviewItemShowTime();
            }
        }
    } catch (JsonSyntaxException e) {
        AppLogger.e(e.getMessage());
    }
    return value;
}
Also used : DMUserBean(org.qii.weiciyuan.bean.DMUserBean) JsonSyntaxException(com.google.gson.JsonSyntaxException) HashMap(java.util.HashMap) DMUserListBean(org.qii.weiciyuan.bean.DMUserListBean) Gson(com.google.gson.Gson)

Example 4 with DMUserBean

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

the class ObjectToStringUtility method toString.

public static String toString(DMUserBean dm) {
    UserBean userBean = dm.getUser();
    String username = (userBean != null ? userBean.getScreen_name() : "user is null");
    return String.format("%s @%s:%s", TimeUtility.getListTime(dm.getMills()), username, dm.getText());
}
Also used : UserBean(org.qii.weiciyuan.bean.UserBean) SearchUserBean(org.qii.weiciyuan.bean.SearchUserBean) AtUserBean(org.qii.weiciyuan.bean.AtUserBean) DMUserBean(org.qii.weiciyuan.bean.DMUserBean)

Aggregations

DMUserBean (org.qii.weiciyuan.bean.DMUserBean)4 Gson (com.google.gson.Gson)2 JsonSyntaxException (com.google.gson.JsonSyntaxException)2 DMUserListBean (org.qii.weiciyuan.bean.DMUserListBean)2 UserBean (org.qii.weiciyuan.bean.UserBean)2 Cursor (android.database.Cursor)1 HashMap (java.util.HashMap)1 AtUserBean (org.qii.weiciyuan.bean.AtUserBean)1 SearchUserBean (org.qii.weiciyuan.bean.SearchUserBean)1