use of org.qii.weiciyuan.bean.android.TimeLinePosition in project weiciyuan by qii.
the class LeftMenuFragment method readUnreadCountFromDB.
private void readUnreadCountFromDB() {
TimeLinePosition position = MentionWeiboTimeLineDBTask.getPosition(GlobalContext.getInstance().getCurrentAccountId());
TreeSet<Long> hashSet = position.newMsgIds;
if (hashSet != null) {
mentionsWeiboUnreadCount = hashSet.size();
}
position = MentionCommentsTimeLineDBTask.getPosition(GlobalContext.getInstance().getCurrentAccountId());
hashSet = position.newMsgIds;
if (hashSet != null) {
mentionsCommentUnreadCount = hashSet.size();
}
position = CommentToMeTimeLineDBTask.getPosition(GlobalContext.getInstance().getCurrentAccountId());
hashSet = position.newMsgIds;
if (hashSet != null) {
commentsToMeUnreadCount = hashSet.size();
}
}
use of org.qii.weiciyuan.bean.android.TimeLinePosition in project weiciyuan by qii.
the class AppNotificationCenter method addDatabaseUnreadMentionsComment.
private void addDatabaseUnreadMentionsComment(String accountId, CommentListBean mentions) {
CommentTimeLineData dbData = MentionCommentsTimeLineDBTask.getCommentLineMsgList(accountId);
List<CommentBean> itemList = dbData.cmtList.getItemList();
TimeLinePosition position = dbData.position;
TreeSet<Long> newMsgIds = position.newMsgIds;
HashMap<Long, CommentBean> map = new HashMap<>();
for (CommentBean msg : itemList) {
map.put(msg.getIdLong(), msg);
}
for (Object object : newMsgIds) {
long id;
if (object instanceof Double) {
Double value = (Double) object;
id = value.longValue();
} else {
id = (Long) object;
}
CommentBean msg = map.get(id);
if (msg != null) {
mentions.getItemList().add(msg);
}
}
}
use of org.qii.weiciyuan.bean.android.TimeLinePosition in project weiciyuan by qii.
the class AppNotificationCenter method addDatabaseUnreadMentionsWeibo.
private void addDatabaseUnreadMentionsWeibo(String accountId, MessageListBean mentions) {
MentionTimeLineData dbData = MentionWeiboTimeLineDBTask.getRepostLineMsgList(accountId);
List<MessageBean> itemList = dbData.msgList.getItemList();
TimeLinePosition position = dbData.position;
TreeSet<Long> newMsgIds = position.newMsgIds;
HashMap<Long, MessageBean> map = new HashMap<>();
for (MessageBean msg : itemList) {
map.put(msg.getIdLong(), msg);
}
for (Object object : newMsgIds) {
long id;
if (object instanceof Double) {
Double value = (Double) object;
id = value.longValue();
} else {
id = (Long) object;
}
MessageBean msg = map.get(id);
if (msg != null) {
mentions.getItemList().add(msg);
}
}
}
use of org.qii.weiciyuan.bean.android.TimeLinePosition in project weiciyuan by qii.
the class FavouriteDBTask method getPosition.
private static TimeLinePosition getPosition(String accountId) {
String sql = "select * from " + FavouriteTable.TABLE_NAME + " where " + FavouriteTable.ACCOUNTID + " = " + accountId;
Cursor c = getRsd().rawQuery(sql, null);
Gson gson = new Gson();
while (c.moveToNext()) {
String json = c.getString(c.getColumnIndex(FavouriteTable.TIMELINEDATA));
if (!TextUtils.isEmpty(json)) {
try {
TimeLinePosition value = gson.fromJson(json, TimeLinePosition.class);
c.close();
return value;
} catch (JsonSyntaxException e) {
e.printStackTrace();
}
}
}
c.close();
return TimeLinePosition.empty();
}
use of org.qii.weiciyuan.bean.android.TimeLinePosition in project weiciyuan by qii.
the class FriendsTimeLineDBTask method getPosition.
private static TimeLinePosition getPosition(String accountId) {
String sql = "select * from " + HomeTable.TABLE_NAME + " where " + HomeTable.ACCOUNTID + " = " + accountId;
Cursor c = getRsd().rawQuery(sql, null);
Gson gson = new Gson();
while (c.moveToNext()) {
String json = c.getString(c.getColumnIndex(HomeTable.TIMELINEDATA));
if (!TextUtils.isEmpty(json)) {
try {
TimeLinePosition value = gson.fromJson(json, TimeLinePosition.class);
c.close();
return value;
} catch (JsonSyntaxException e) {
e.printStackTrace();
}
}
}
c.close();
return TimeLinePosition.empty();
}
Aggregations