Ejemplo n.º 1
1
        @Override
        public void onReceive(Context context, Intent intent) {
          if (intent.getAction().equals(Constants.INTENT_ACTION_NOTICE)) {
            mNotice = (Notice) intent.getSerializableExtra("notice_bean");
            int atmeCount = mNotice.getAtmeCount(); // @我
            int msgCount = mNotice.getMsgCount(); // 留言
            int reviewCount = mNotice.getReviewCount(); // 评论
            int newFansCount = mNotice.getNewFansCount(); // 新粉丝
            int newLikeCount = mNotice.getNewLikeCount(); // 收到赞
            int activeCount = atmeCount + reviewCount + msgCount + newFansCount + newLikeCount;

            Fragment fragment = getCurrentFragment();
            if (fragment instanceof MyInformationFragment) {
              ((MyInformationFragment) fragment).setNotice();
            } else {
              if (activeCount > 0) {
                mBvNotice.setText(activeCount + "");
                mBvNotice.show();
              } else {
                mBvNotice.hide();
                mNotice = null;
              }
            }
          } else if (intent.getAction().equals(Constants.INTENT_ACTION_LOGOUT)) {
            mBvNotice.hide();
            mNotice = null;
          }
        }