public static int getCount(UnreadBean unreadBean) {
    int count = 0;

    if (SettingUtils.allowMentionToMe()) {
      count += unreadBean.getMention_status();
    }

    if (SettingUtils.allowCommentToMe()) {
      count += unreadBean.getCmt();
    }

    if (SettingUtils.allowMentionCommentToMe()) {
      count += unreadBean.getMention_cmt();
    }

    return count;
  }
Esempio n. 2
0
  @Override
  public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {

    buildSummary();

    if (key.equals(SettingActivity.LIST_AVATAR_MODE)) {
      String value = sharedPreferences.getString(key, "1");
      if (value.equals("1")) SettingUtils.setEnableBigAvatar(false);
      if (value.equals("2")) SettingUtils.setEnableBigAvatar(true);
      if (value.equals("3")) {
        SettingUtils.setEnableBigAvatar(Utility.isWifi(getActivity()));
      }
    }

    if (key.equals(SettingActivity.LIST_PIC_MODE)) {
      String value = sharedPreferences.getString(key, "1");
      if (value.equals("1")) {
        SettingUtils.setEnableBigPic(false);
        // listHighPicMode.setEnabled(false);
      }
      if (value.equals("2")) {
        SettingUtils.setEnableBigPic(true);
        // listHighPicMode.setEnabled(true);
      }
      if (value.equals("3")) {
        SettingUtils.setEnableBigPic(Utility.isWifi(getActivity()));
        // listHighPicMode.setEnabled(true);
      }
    }
    if (key.equals(SettingActivity.LIST_HIGH_PIC_MODE)) {
      BeeboApplication.getInstance().getBitmapCache().evictAll();
    }
  }
Esempio n. 3
0
  public SearchDao(String access_token, String q) {

    this.access_token = access_token;
    this.q = q;
    this.count = SettingUtils.getMsgCount();
  }
  @Deprecated
  public static String getTicker(
      UnreadBean unreadBean,
      MessageListBean mentionsWeibo,
      CommentListBean mentionsComment,
      CommentListBean commentsToMe) {
    int unreadMentionCmt = unreadBean.getMention_cmt();
    int unreadMentionStatus = unreadBean.getMention_status();
    int mention = 0;
    if (SettingUtils.allowMentionToMe() && unreadMentionStatus > 0 && mentionsWeibo != null) {
      int actualFetchedSize = mentionsWeibo.getSize();
      if (actualFetchedSize < Integer.valueOf(SettingUtils.getMsgCount())) {
        mention += actualFetchedSize;
      } else {
        mention += Math.max(actualFetchedSize, unreadMentionStatus);
      }
    }
    if (SettingUtils.allowMentionCommentToMe() && unreadMentionCmt > 0 && mentionsComment != null) {
      int actualFetchedSize = mentionsComment.getSize();
      if (actualFetchedSize < Integer.valueOf(SettingUtils.getMsgCount())) {
        mention += actualFetchedSize;
      } else {
        mention += Math.max(actualFetchedSize, unreadMentionCmt);
      }
    }

    StringBuilder stringBuilder = new StringBuilder();
    if (mention > 0) {
      String txt =
          String.format(
              BeeboApplication.getInstance().getString(R.string.new_mentions),
              String.valueOf(mention));
      stringBuilder.append(txt);
    }

    int unreadCmt = unreadBean.getCmt();

    int cmt = 0;

    if (SettingUtils.allowCommentToMe() && unreadCmt > 0 && commentsToMe != null) {
      //
      int actualFetchedSize = commentsToMe.getSize();
      if (actualFetchedSize < Integer.valueOf(SettingUtils.getMsgCount())) {
        cmt += actualFetchedSize;
      } else {
        cmt += Math.max(actualFetchedSize, unreadCmt);
      }

      if (mention > 0) {
        stringBuilder.append("、");
      }

      if (cmt > 0) {
        String txt =
            String.format(
                BeeboApplication.getInstance().getString(R.string.new_comments),
                String.valueOf(cmt));
        stringBuilder.append(txt);
      }
    }
    return stringBuilder.toString();
  }