use of org.qii.weiciyuan.bean.FavListBean in project weiciyuan by qii.
the class FavouriteDBTask method getFavouriteMsgList.
public static FavouriteTimeLineData getFavouriteMsgList(String accountId) {
FavListBean result = new FavListBean();
List<FavBean> msgList = new ArrayList<FavBean>();
String sql = "select * from " + FavouriteTable.FavouriteDataTable.TABLE_NAME + " where " + FavouriteTable.FavouriteDataTable.ACCOUNTID + " = " + accountId + " order by " + FavouriteTable.FavouriteDataTable.MBLOGID + " desc";
Cursor c = getRsd().rawQuery(sql, null);
Gson gson = new Gson();
while (c.moveToNext()) {
String json = c.getString(c.getColumnIndex(FavouriteTable.FavouriteDataTable.JSONDATA));
try {
FavBean value = gson.fromJson(json, FavBean.class);
if (value != null && !value.getStatus().isMiddleUnreadItem()) {
value.getStatus().getListViewSpannableString();
}
msgList.add(value);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
}
result.setFavorites(msgList);
c.close();
sql = "select * from " + FavouriteTable.TABLE_NAME + " where " + FavouriteTable.ACCOUNTID + " = " + accountId;
c = getRsd().rawQuery(sql, null);
int page = 0;
while (c.moveToNext()) {
page = c.getInt(c.getColumnIndex(FavouriteTable.PAGE));
}
c.close();
return new FavouriteTimeLineData(result, page, getPosition(accountId));
}
use of org.qii.weiciyuan.bean.FavListBean in project weiciyuan by qii.
the class MyFavMsgLoader method loadData.
public FavListBean loadData() throws WeiboException {
FavListDao dao = new FavListDao(token);
dao.setPage(page);
FavListBean result = null;
lock.lock();
try {
result = dao.getGSONMsgList();
} finally {
lock.unlock();
}
return result;
}
use of org.qii.weiciyuan.bean.FavListBean 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;
}
Aggregations