Search in sources :

Example 1 with DMUserListBean

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

the class DMUserLoader method loadData.

public DMUserListBean loadData() throws WeiboException {
    DMDao dao = new DMDao(token);
    dao.setCursor(cursor);
    DMUserListBean result = null;
    lock.lock();
    try {
        result = dao.getUserList();
    } finally {
        lock.unlock();
    }
    return result;
}
Also used : DMUserListBean(org.qii.weiciyuan.bean.DMUserListBean) DMDao(org.qii.weiciyuan.dao.dm.DMDao)

Example 2 with DMUserListBean

use of org.qii.weiciyuan.bean.DMUserListBean 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 DMUserListBean

use of org.qii.weiciyuan.bean.DMUserListBean 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)

Aggregations

DMUserListBean (org.qii.weiciyuan.bean.DMUserListBean)3 Gson (com.google.gson.Gson)2 JsonSyntaxException (com.google.gson.JsonSyntaxException)2 DMUserBean (org.qii.weiciyuan.bean.DMUserBean)2 Cursor (android.database.Cursor)1 HashMap (java.util.HashMap)1 DMDao (org.qii.weiciyuan.dao.dm.DMDao)1