use of org.qii.weiciyuan.dao.maintimeline.MainCommentsTimeLineDao in project weiciyuan by qii.
the class FetchNewMsgService method fetchMsg.
private void fetchMsg(AccountBean accountBean) throws WeiboException {
CommentListBean commentResult = null;
MessageListBean mentionStatusesResult = null;
CommentListBean mentionCommentsResult = null;
UnreadBean unreadBean = null;
String token = accountBean.getAccess_token();
UnreadDao unreadDao = new UnreadDao(token, accountBean.getUid());
unreadBean = unreadDao.getCount();
if (unreadBean == null) {
return;
}
int unreadCommentCount = unreadBean.getCmt();
int unreadMentionStatusCount = unreadBean.getMention_status();
int unreadMentionCommentCount = unreadBean.getMention_cmt();
if (unreadCommentCount > 0 && SettingUtility.allowCommentToMe()) {
MainCommentsTimeLineDao dao = new MainCommentsTimeLineDao(token);
CommentListBean oldData = null;
CommentTimeLineData commentTimeLineData = CommentToMeTimeLineDBTask.getCommentLineMsgList(accountBean.getUid());
if (commentTimeLineData != null) {
oldData = commentTimeLineData.cmtList;
}
if (oldData != null && oldData.getSize() > 0) {
dao.setSince_id(oldData.getItem(0).getId());
}
commentResult = dao.getGSONMsgListWithoutClearUnread();
}
if (unreadMentionStatusCount > 0 && SettingUtility.allowMentionToMe()) {
MentionsWeiboTimeLineDao dao = new MentionsWeiboTimeLineDao(token);
MessageListBean oldData = null;
MentionTimeLineData mentionStatusTimeLineData = MentionWeiboTimeLineDBTask.getRepostLineMsgList(accountBean.getUid());
if (mentionStatusTimeLineData != null) {
oldData = mentionStatusTimeLineData.msgList;
}
if (oldData != null && oldData.getSize() > 0) {
dao.setSince_id(oldData.getItem(0).getId());
}
mentionStatusesResult = dao.getGSONMsgListWithoutClearUnread();
}
if (unreadMentionCommentCount > 0 && SettingUtility.allowMentionCommentToMe()) {
MainCommentsTimeLineDao dao = new MentionsCommentTimeLineDao(token);
CommentListBean oldData = null;
CommentTimeLineData commentTimeLineData = MentionCommentsTimeLineDBTask.getCommentLineMsgList(accountBean.getUid());
if (commentTimeLineData != null) {
oldData = commentTimeLineData.cmtList;
}
if (oldData != null && oldData.getSize() > 0) {
dao.setSince_id(oldData.getItem(0).getId());
}
mentionCommentsResult = dao.getGSONMsgListWithoutClearUnread();
}
clearDatabaseUnreadInfo(accountBean.getUid(), unreadBean.getMention_status(), unreadBean.getMention_cmt(), unreadBean.getCmt());
boolean mentionsWeibo = (mentionStatusesResult != null && mentionStatusesResult.getSize() > 0);
boolean mentionsComment = (mentionCommentsResult != null && mentionCommentsResult.getSize() > 0);
boolean commentsToMe = (commentResult != null && commentResult.getSize() > 0);
if (mentionsWeibo || mentionsComment || commentsToMe) {
sendTwoKindsOfBroadcast(accountBean, commentResult, mentionStatusesResult, mentionCommentsResult, unreadBean);
} else {
// NotificationManager notificationManager = (NotificationManager) getApplicationContext()
// .getSystemService(NOTIFICATION_SERVICE);
// notificationManager.cancel(
// NotificationServiceHelper.getMentionsWeiboNotificationId(accountBean));
}
}
use of org.qii.weiciyuan.dao.maintimeline.MainCommentsTimeLineDao in project weiciyuan by qii.
the class CommentsToMeMsgLoader method loadData.
public CommentListBean loadData() throws WeiboException {
MainCommentsTimeLineDao dao = new MainCommentsTimeLineDao(token);
dao.setSince_id(sinceId);
dao.setMax_id(maxId);
CommentListBean result = null;
lock.lock();
try {
result = dao.getGSONMsgList();
} finally {
lock.unlock();
}
return result;
}
Aggregations