Example #1
0
    @Override
    protected void onSuccess(UnreadCount result) {
      super.onSuccess(result);

      // 通知消息
      unreadCountNotifier.notinfyUnreadCount(AppContext.getUnreadCount());

      sendUnreadBroadcast();
    }
Example #2
0
    @Override
    public UnreadCount workInBackground(Void... params) throws TaskException {
      if (!AppContext.isLogedin()) return null;

      UnreadCount result =
          SinaSDK.getInstance(AppContext.getToken()).remindUnread(AppContext.getUser().getIdstr());
      //			result.setMention_status(500);
      //			result.setMention_cmt(100);
      //			result.setCmt(20);
      //			result.setFollower(10);

      AppContext.setUnreadCount(new UnreadCount());
      ;
      if (AppSettings.isNotifyComment()) AppContext.getUnreadCount().setCmt(result.getCmt());
      if (AppSettings.isNotifyCommentMention())
        AppContext.getUnreadCount().setMention_cmt(result.getMention_cmt());
      if (AppSettings.isNotifyStatusMention())
        AppContext.getUnreadCount().setMention_status(result.getMention_status());
      if (AppSettings.isNotifyFollower())
        AppContext.getUnreadCount().setFollower(result.getFollower());
      if (AppSettings.isNotifyDm()) AppContext.getUnreadCount().setDm(result.getDm());

      // 更新DB
      result.setId(AppContext.getUser().getIdstr());
      SinaDB.getSqlite().insert(null, AppContext.getUnreadCount());
      return result;
    }