use of org.qii.weiciyuan.bean.MessageListBean in project weiciyuan by qii.
the class MyStatusDBTask method get.
public static MyStatusTimeLineData get(String accountId) {
Gson gson = new Gson();
MessageListBean result = new MessageListBean();
List<MessageBean> msgList = new ArrayList<MessageBean>();
String sql = "select * from " + MyStatusTable.StatusDataTable.TABLE_NAME + " where " + MyStatusTable.StatusDataTable.ACCOUNTID + " = " + accountId + " order by " + MyStatusTable.StatusDataTable.MBLOGID + " desc limit 50";
Cursor c = getRsd().rawQuery(sql, null);
while (c.moveToNext()) {
String json = c.getString(c.getColumnIndex(MyStatusTable.StatusDataTable.JSONDATA));
try {
MessageBean value = gson.fromJson(json, MessageBean.class);
if (!value.isMiddleUnreadItem()) {
value.getListViewSpannableString();
}
msgList.add(value);
} catch (JsonSyntaxException ignored) {
}
}
result.setStatuses(msgList);
c.close();
return new MyStatusTimeLineData(result, getPosition(accountId));
}
use of org.qii.weiciyuan.bean.MessageListBean in project weiciyuan by qii.
the class MentionWeiboTimeLineDBTask method getRepostLineMsgList.
public static MentionTimeLineData getRepostLineMsgList(String accountId) {
TimeLinePosition position = getPosition(accountId);
Gson gson = new Gson();
MessageListBean result = new MessageListBean();
int limit = position.position + AppConfig.DB_CACHE_COUNT_OFFSET > AppConfig.DEFAULT_MSG_COUNT_50 ? position.position + AppConfig.DB_CACHE_COUNT_OFFSET : AppConfig.DEFAULT_MSG_COUNT_50;
List<MessageBean> msgList = new ArrayList<MessageBean>();
String sql = "select * from " + RepostsTable.RepostDataTable.TABLE_NAME + " where " + RepostsTable.RepostDataTable.ACCOUNTID + " = " + accountId + " order by " + RepostsTable.RepostDataTable.MBLOGID + " desc limit " + limit;
Cursor c = getRsd().rawQuery(sql, null);
while (c.moveToNext()) {
String json = c.getString(c.getColumnIndex(RepostsTable.RepostDataTable.JSONDATA));
if (!TextUtils.isEmpty(json)) {
try {
MessageBean value = gson.fromJson(json, MessageBean.class);
if (!value.isMiddleUnreadItem()) {
value.getListViewSpannableString();
}
msgList.add(value);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
} else {
msgList.add(null);
}
}
result.setStatuses(msgList);
c.close();
MentionTimeLineData mentionTimeLineData = new MentionTimeLineData(result, position);
return mentionTimeLineData;
}
use of org.qii.weiciyuan.bean.MessageListBean in project weiciyuan by qii.
the class MentionWeiboTimeLineDBTask method asyncReplace.
public static void asyncReplace(final MessageListBean list, final String accountId) {
final MessageListBean data = new MessageListBean();
data.replaceData(list);
new Thread(new Runnable() {
@Override
public void run() {
deleteAllReposts(accountId);
addRepostLineMsg(data, accountId);
}
}).start();
}
use of org.qii.weiciyuan.bean.MessageListBean in project weiciyuan by qii.
the class StatusesByIdLoader method loadData.
public MessageListBean loadData() throws WeiboException {
StatusesTimeLineDao dao = new StatusesTimeLineDao(token, uid);
if (TextUtils.isEmpty(uid)) {
dao.setScreen_name(screenName);
}
if (!TextUtils.isEmpty(count)) {
dao.setCount(count);
}
dao.setSince_id(sinceId);
dao.setMax_id(maxId);
MessageListBean result = null;
lock.lock();
try {
result = dao.getGSONMsgList();
} finally {
lock.unlock();
}
return result;
}
use of org.qii.weiciyuan.bean.MessageListBean in project weiciyuan by qii.
the class MainFriendsTimeLineDao method getGSONMsgList.
public MessageListBean getGSONMsgList() 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());
throw new WeiboException(e.getMessage());
}
if (value != null && value.getItemList().size() > 0) {
TimeLineUtility.filterMessage(value);
TimeLineUtility.filterHomeTimeLineSinaWeiboAd(value);
}
return value;
}
Aggregations