コード例 #1
0
 /**
  * 获取在线人数
  *
  * @param users
  * @return
  */
 protected int getOnlineCount(List<? extends QQUser> users) {
   int count = 0;
   for (QQUser user : users) {
     QQStatus stat = user.getStatus();
     if (QQStatus.isGeneralOnline(stat)) {
       count++;
     }
   }
   return count;
 }
コード例 #2
0
    @Override
    public int compare(UserListElement o1, UserListElement o2) {
      if (o1.getUserNamed() instanceof UIUser && o2.getUserNamed() instanceof UIUser) {
        QQUser user1 = (QQUser) o1.getUserNamed().getEntity();
        QQUser user2 = (QQUser) o2.getUserNamed().getEntity();
        if (user1.getStatus() == user2.getStatus()) {
          return user1.getNickname().compareTo(user2.getNickname());
        }

        List<QQStatus> orders = new ArrayList<QQStatus>();
        orders.add(QQStatus.ONLINE);
        orders.add(QQStatus.AWAY);
        orders.add(QQStatus.CALLME);
        orders.add(QQStatus.BUSY);
        orders.add(QQStatus.SLIENT);
        orders.add(QQStatus.HIDDEN);
        orders.add(QQStatus.OFFLINE);
        return orders.indexOf(user1.getStatus()) - orders.indexOf(user2.getStatus());
      }
      return 0;
    }