示例#1
0
  void populateFromGroup(RosterItemView rosterItemView, Group g) {
    Group group = g;
    g = RosterHelper.getInstance().getGroupWithContacts(g);
    if (g == null) g = group;
    rosterItemView.itemNameColor = Scheme.getColor(R.attr.group);
    rosterItemView.itemNameFont = Typeface.DEFAULT;
    rosterItemView.itemName = g.getText();

    rosterItemView.itemFirstImage =
        new Icon(g.isExpanded() ? SawimResources.groupDownIcon : SawimResources.groupRightIcons)
            .getImage()
            .getBitmap();

    Drawable messIcon = ChatHistory.instance.getUnreadMessageIcon(g.getContacts());
    if (messIcon != null) {
      if (messIcon == SawimResources.PERSONAL_MESSAGE_ICON) {
        messIcon = messIcon.getConstantState().newDrawable();
        messIcon.setColorFilter(
            Scheme.getColor(R.attr.personal_unread_message), PorterDuff.Mode.MULTIPLY);
      } else {
        messIcon = messIcon.getConstantState().newDrawable();
        messIcon.setColorFilter(Scheme.getColor(R.attr.unread_message), PorterDuff.Mode.MULTIPLY);
      }
    }
    if (!g.isExpanded() && messIcon != null) rosterItemView.itemFifthImage = messIcon;
  }
示例#2
0
 public static Group copyGroupWithoutContacts(Group g) {
   Group newGroup = new Group(g.getText());
   newGroup.setGroupId(g.getGroupId());
   newGroup.setMode(g.getMode());
   newGroup.setExpandFlag(g.isExpanded());
   return newGroup;
 }
示例#3
0
  public void rebuildFlatItemsWG(Protocol p, List<TreeNode> list) {
    int contactCounter;
    int onlineContactCounter;
    Enumeration<Group> e = p.getGroupItems().elements();
    while (e.hasMoreElements()) {
      Group group = e.nextElement();
      contactCounter = 0;
      onlineContactCounter = 0;
      Group newGroup = copyGroupWithoutContacts(group);
      list.add(newGroup);
      List<Contact> contacts = group.getContacts();
      int contactsSize = contacts.size();
      for (Contact contact : contacts) {
        // if (contact.isVisibleInContactList()) {
        if (newGroup.isExpanded()) {
          list.add(contact);
        }
        contactCounter++;
        // }
        if (contact.isOnline()) ++onlineContactCounter;
      }
      if (0 == contactCounter) {
        list.remove(list.size() - 1);
      }
      group.updateGroupData(contactsSize, onlineContactCounter);
    }

    Group group = p.getNotInListGroup();
    list.add(group);
    List<Contact> contacts = group.getContacts();
    contactCounter = 0;
    onlineContactCounter = 0;
    int contactsSize = contacts.size();
    for (Contact contact : contacts) {
      // if (contact.isVisibleInContactList()) {
      if (group.isExpanded()) {
        list.add(contact);
      }
      contactCounter++;
      // }
      if (contact.isOnline()) ++onlineContactCounter;
    }
    if (0 == contactCounter) {
      list.remove(list.size() - 1);
    }
    group.updateGroupData(contactsSize, onlineContactCounter);
    RosterHelper.sort(list, p.getGroupItems());
  }