use of org.aisen.weibo.sina.sinasdk.bean.SetCount in project AisenWeiBo by wangdan.
the class BizFragment method remindSetCount.
public void remindSetCount(final RemindType remindType) {
// 测试通知功能时,不清零
if (AppSettings.ignoreUnread()) {
return;
}
final String uid = AppContext.getAccount().getUser().getIdstr();
new WorkTask<RemindType, Void, SetCount>() {
@Override
public SetCount workInBackground(RemindType... params) throws TaskException {
return SinaSDK.getInstance(AppContext.getAccount().getAccessToken()).remindSetCount(params[0].toString());
}
@Override
protected void onSuccess(SetCount result) {
super.onSuccess(result);
if (getRealActivity() == null)
return;
UnreadCount count = AppContext.getAccount().getUnreadCount();
if (count != null) {
UnreadCountNotifier notifier = new UnreadCountNotifier(getRealActivity());
if (remindType == RemindType.cmt) {
count.setCmt(0);
notifier.cancelNotification(Notifier.RemindUnreadComments);
} else if (remindType == RemindType.follower) {
count.setFollower(0);
notifier.cancelNotification(Notifier.RemindUnreadForFollowers);
} else if (remindType == RemindType.mention_cmt) {
count.setMention_cmt(0);
notifier.cancelNotification(Notifier.RemindUnreadForMentionComments);
} else if (remindType == RemindType.mention_status) {
count.setMention_status(0);
notifier.cancelNotification(Notifier.RemindUnreadForMentionStatus);
}
// 更新DB
SinaDB.getDB().insert(new Extra(uid, null), count);
AppContext.getAccount().setUnreadCount(count);
UnreadCountNotifier.mCount = count;
// 发出广播更新状态
UnreadService.sendUnreadBroadcast();
}
}
;
}.execute(remindType);
}
Aggregations