Esempio n. 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;
  }
Esempio n. 2
0
  void populateFromProtocol(RosterItemView rosterItemView, ProtocolBranch o) {
    rosterItemView.itemNameColor = Scheme.getColor(R.attr.group);
    rosterItemView.itemNameFont = Typeface.DEFAULT;
    rosterItemView.itemName = o.getText();

    rosterItemView.itemSecondImage =
        new Icon(o.isExpanded() ? SawimResources.groupDownIcon : SawimResources.groupRightIcons)
            .getImage();

    Icon icGroup = o.getProtocol().getCurrentStatusIcon();
    if (icGroup != null) rosterItemView.itemThirdImage = icGroup.getImage().getBitmap();

    Profile profile = o.getProtocol().getProfile();
    if (profile != null) {
      if (profile.xstatusIndex != XStatusInfo.XSTATUS_NONE) {
        XStatusInfo xStatusInfo = o.getProtocol().getXStatusInfo();
        if (xStatusInfo != null) {
          Icon xStatusIcon = xStatusInfo.getIcon(profile.xstatusIndex);
          if (xStatusIcon != null)
            rosterItemView.itemFourthImage = xStatusIcon.getImage().getBitmap();
        }
      }
    }

    Drawable messIcon = ChatHistory.instance.getUnreadMessageIcon();
    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 (!o.isExpanded() && messIcon != null) rosterItemView.itemFifthImage = messIcon;
  }