use of org.aisen.weibo.sina.sinasdk.bean.UnreadCount 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);
}
use of org.aisen.weibo.sina.sinasdk.bean.UnreadCount in project AisenWeiBo by wangdan.
the class AccountFragment method login.
// 登录账号
public static void login(AccountBean accountBean, boolean toMain) {
if (AppContext.isLoggedIn()) {
// 1、清理定时发布
MyApplication.removeAllPublishAlarm();
// 2、清理正在发布的数据
PublishService.stopPublish();
// 3、重新开始读取未读消息
UnreadService.stopService();
// 4、清理未读消息
UnreadCountNotifier.mCount = new UnreadCount();
// 5、清理通知栏
PublishNotifier.cancelAll();
}
// 登录该账号
AppContext.login(accountBean);
AccountUtils.setLogedinAccount(accountBean);
// 进入首页
if (toMain) {
MainActivity.login();
MainActivity.runCheckAccountTask(accountBean);
}
}
use of org.aisen.weibo.sina.sinasdk.bean.UnreadCount in project AisenWeiBo by wangdan.
the class MenuFragment method setUnreadNotification.
private void setUnreadNotification() {
// 通知
UnreadCount unreadCount = AppContext.getAccount().getUnreadCount();
int count = 0;
if (unreadCount != null) {
count = unreadCount.getCmt() + unreadCount.getMention_cmt() + unreadCount.getMention_status();
}
setNavMenuUnread(MENU_NOTIFICATION, count);
// 私信
count = 0;
if (unreadCount != null) {
count = unreadCount.getDm();
}
setNavMenuUnread(MENU_MD, count);
}
use of org.aisen.weibo.sina.sinasdk.bean.UnreadCount in project AisenWeiBo by wangdan.
the class UnreadService method stopService.
public static void stopService() {
clearAlarm();
if (AppContext.isLoggedIn()) {
UnreadCountNotifier.mCount = new UnreadCount();
}
Intent intent = new Intent(GlobalContext.getInstance(), UnreadService.class);
GlobalContext.getInstance().stopService(intent);
}
use of org.aisen.weibo.sina.sinasdk.bean.UnreadCount in project AisenWeiBo by wangdan.
the class AppContext method login.
public static void login(AccountBean accountBean) {
AppContext.setAccount(accountBean);
// 未读消息重置
if (AppContext.getAccount().getUnreadCount() == null) {
AppContext.getAccount().setUnreadCount(UnreadService.getUnreadCount());
}
if (AppContext.getAccount().getUnreadCount() == null) {
AppContext.getAccount().setUnreadCount(new UnreadCount());
}
// 开启未读服务
UnreadService.startService();
// 刷新定时任务
MyApplication.refreshPublishAlarm();
// 处理点赞数据
DoLikeAction.refreshLikeCache();
// 停止离线服务
if (OfflineService.getInstance() != null)
OfflineService.stopOffline();
// 设置友盟的账号统计
MobclickAgent.onProfileSignIn(accountBean.getUid());
}
Aggregations