示例#1
0
  public final void bind(Context context, final MultiDeleteListItemData ch) {
    setMultiDeleteHeader(ch);

    // Date
    mDateView.setText(ch.getDate());

    // From.
    mFromView.setText(formatMessage(ch));

    // Register for updates in changes of any of the contacts in this conversation.
    ContactList contacts = ch.getContacts();
    Contact.addListener(this);

    // Subject
    mSubjectView.setText(ch.getSubject());
    mSubjectView.setSingleLine(true);
    mSubjectView.setEllipsize(TextUtils.TruncateAt.END);
    updateAvatarView();
    mCheckbox.setChecked(ch.isSelected());
  }
示例#2
0
  private void updateAvatarView() {
    MultiDeleteListItemData ch = mMultiDeleteThreadData;

    Drawable avatarDrawable;
    if (ch.getContacts().size() == 1) {
      Contact contact = ch.getContacts().get(0);
      avatarDrawable = contact.getAvatar(mContext, sDefaultContactImage);

      if (contact.existsInDatabase()) {
        mAvatarView.assignContactUri(contact.getUri());
      } else {
        mAvatarView.assignContactFromPhone(contact.getNumber(), true);
      }
    } else {
      // TODO get a multiple recipients asset (or do something else)
      avatarDrawable = sDefaultContactImage;
      mAvatarView.assignContactUri(null);
    }
    mAvatarView.setImageDrawable(avatarDrawable);
  }
示例#3
0
  private CharSequence formatMessage(MultiDeleteListItemData ch) {
    final int size = android.R.style.TextAppearance_Small;
    final int color = android.R.styleable.Theme_textColorSecondary;
    String from = ch.getFrom();

    SpannableStringBuilder buf = new SpannableStringBuilder(from);
    if (ch.hasDraft() && ch.getMessageCount() == 0) {
      // only draft
    } else {
      if (ch.getUnreadMessageCount() > 0) {
        buf.append(" (" + ch.getUnreadMessageCount() + "/");
      } else {
        buf.append(" (" + "0/");
      }
      // if (ch.getMessageCount() > 1) {
      buf.append(ch.getMessageCount() + ") ");
      // }
    }
    /*
    if (ch.getMessageCount() > 1) {
        buf.append(" (" + ch.getMessageCount() + ") ");
    }
    */
    return buf;
  }
示例#4
0
 private void updateFromView() {
   MultiDeleteListItemData ch = mMultiDeleteThreadData;
   ch.updateRecipients();
   mFromView.setText(formatMessage(ch));
   updateAvatarView();
 }