Search in sources :

Example 6 with UnreadBean

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

the class AppNotificationCenter method showAndroidNotification.

public void showAndroidNotification(AccountBean account) {
    UnreadBean unreadBean = unreadBeans.get(account);
    MessageListBean mentions = unreadMentions.get(account);
    CommentListBean comments = unreadComments.get(account);
    CommentListBean mentionsComment = unreadMentionsComment.get(account);
    String accountId = account.getUid();
    if (mentions == null) {
        mentions = new MessageListBean();
    }
    addDatabaseUnreadMentionsWeibo(accountId, mentions);
    Utility.removeDuplicateAndSortStatus(mentions.getItemList());
    if (comments == null) {
        comments = new CommentListBean();
    }
    addDatabaseUnreadCommentsToMe(accountId, comments);
    Utility.removeDuplicateAndSortComment(comments.getItemList());
    if (mentionsComment == null) {
        mentionsComment = new CommentListBean();
    }
    addDatabaseUnreadMentionsComment(accountId, mentionsComment);
    Utility.removeDuplicateAndSortComment(mentionsComment.getItemList());
    showNotification(GlobalContext.getInstance(), account, mentions, comments, mentionsComment, unreadBean);
}
Also used : UnreadBean(org.qii.weiciyuan.bean.UnreadBean) MessageListBean(org.qii.weiciyuan.bean.MessageListBean) CommentListBean(org.qii.weiciyuan.bean.CommentListBean)

Example 7 with UnreadBean

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

the class ClearUnreadDao method clearCommentUnread.

public boolean clearCommentUnread(UnreadBean unreadBean, String accountId) throws WeiboException {
    int count = unreadBean.getCmt();
    UnreadBean currentCount = new UnreadDao(access_token, accountId).getCount();
    if (currentCount == null) {
        return false;
    }
    //already reset or have new unread message
    if (count != currentCount.getCmt()) {
        return false;
    }
    return new ClearUnreadDao(access_token, ClearUnreadDao.CMT).clearUnread();
}
Also used : UnreadBean(org.qii.weiciyuan.bean.UnreadBean)

Example 8 with UnreadBean

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

the class ClearUnreadDao method clearMentionCommentUnread.

public boolean clearMentionCommentUnread(UnreadBean unreadBean, String accountId) throws WeiboException {
    int count = unreadBean.getMention_cmt();
    UnreadBean currentCount = new UnreadDao(access_token, accountId).getCount();
    if (currentCount == null) {
        return false;
    }
    //already reset or have new unread message
    if (count != currentCount.getMention_cmt()) {
        return false;
    }
    return new ClearUnreadDao(access_token, ClearUnreadDao.MENTION_CMT).clearUnread();
}
Also used : UnreadBean(org.qii.weiciyuan.bean.UnreadBean)

Example 9 with UnreadBean

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

the class UnreadDao method getCount.

public UnreadBean getCount() throws WeiboException {
    String json = getMsgListJson();
    Gson gson = new Gson();
    UnreadBean value = null;
    try {
        value = gson.fromJson(json, UnreadBean.class);
    } catch (JsonSyntaxException e) {
        AppLogger.e(e.getMessage());
        return null;
    }
    return value;
}
Also used : UnreadBean(org.qii.weiciyuan.bean.UnreadBean) JsonSyntaxException(com.google.gson.JsonSyntaxException) Gson(com.google.gson.Gson)

Aggregations

UnreadBean (org.qii.weiciyuan.bean.UnreadBean)9 CommentListBean (org.qii.weiciyuan.bean.CommentListBean)4 MessageListBean (org.qii.weiciyuan.bean.MessageListBean)4 AccountBean (org.qii.weiciyuan.bean.AccountBean)3 Notification (android.app.Notification)2 NotificationManager (android.app.NotificationManager)2 PendingIntent (android.app.PendingIntent)2 Context (android.content.Context)2 Intent (android.content.Intent)2 IntentFilter (android.content.IntentFilter)2 Handler (android.os.Handler)2 RecordOperationAppBroadcastReceiver (org.qii.weiciyuan.support.lib.RecordOperationAppBroadcastReceiver)2 GlobalContext (org.qii.weiciyuan.support.utils.GlobalContext)2 Bitmap (android.graphics.Bitmap)1 BitmapFactory (android.graphics.BitmapFactory)1 Parcelable (android.os.Parcelable)1 Gson (com.google.gson.Gson)1 JsonSyntaxException (com.google.gson.JsonSyntaxException)1 ArrayList (java.util.ArrayList)1 CommentBean (org.qii.weiciyuan.bean.CommentBean)1