Methods Summary |
---|
public void | add(com.android.mms.ui.RecipientList$Recipient r)
if ((null != r) && Recipient.isValid(r.number)) {
mRecipients.add(r.filter());
} else {
mInvalidRecipients.add(r);
}
|
public boolean | containsBcc()
int count = mRecipients.size();
for (int i = 0; i < count; i++) {
if (mRecipients.get(i).bcc) {
return true;
}
}
return false;
|
public boolean | containsEmail()
int count = mRecipients.size();
for (int i = 0; i < count; i++) {
if (Mms.isEmailAddress(mRecipients.get(i).number)) {
return true;
}
}
return false;
|
public int | countInvalidRecipients() return mInvalidRecipients.size();
|
public static com.android.mms.ui.RecipientList | from(java.lang.String address, android.content.Context context)
RecipientList list = new RecipientList();
ContactInfoCache cache = ContactInfoCache.getInstance();
if (!TextUtils.isEmpty(address)) {
String[] phoneNumbers = address.split(MessageSender.RECIPIENTS_SEPARATOR);
for (String number : phoneNumbers) {
Recipient recipient = new Recipient();
if (number.startsWith("%bcc%")) {
recipient.bcc = true;
number = number.substring(5);
}
/*
* TODO: Consider getting the CallerInfo object asynchronously
* to help with ui responsiveness, instead of running the query
* directly from the UI thread
*/
ContactInfoCache.CacheEntry entry = cache.getContactInfo(context, number);
recipient.person_id = entry.person_id;
if (TextUtils.isEmpty(entry.name)) {
if (MessageUtils.isLocalNumber(entry.phoneNumber)) {
recipient.name = context.getString(R.string.messagelist_sender_self);
} else {
recipient.name = entry.phoneNumber;
}
} else {
recipient.name = entry.name;
}
if (Mms.isEmailAddress(number)) {
recipient.number = number;
recipient.name = cache.getDisplayName(context, number);
} else {
recipient.label = entry.phoneLabel;
recipient.number = (entry.phoneNumber == null) ? "" : entry.phoneNumber;
}
recipient.nameAndNumber = Recipient.buildNameAndNumber(recipient.name,
recipient.number);
list.add(recipient.filter());
}
}
return list;
|
public java.lang.String[] | getBccNumbers()
ArrayList<String> numbers = new ArrayList<String>();
int count = mRecipients.size();
for (int i = 0 ; i < count ; i++) {
Recipient recipient = mRecipients.get(i);
if (recipient.bcc && !TextUtils.isEmpty(recipient.number)) {
numbers.add(recipient.number);
}
}
return numbers.toArray(new String[numbers.size()]);
|
public java.lang.String | getInvalidRecipientString()
StringBuilder sb = new StringBuilder();
int count = mInvalidRecipients.size();
for (int i = 0 ; i < count ; i++) {
if (i != 0) {
sb.append(",");
}
Recipient recipient = mInvalidRecipients.get(i);
if (recipient.bcc) {
sb.append("%bcc%");
}
sb.append(recipient.number);
}
return sb.toString();
|
public java.lang.String[] | getNumbers()
int count = mRecipients.size();
ArrayList<String> numbers = new ArrayList<String>(count);
for (int i = 0 ; i < count ; i++) {
numbers.add((mRecipients.get(i)).number);
}
return numbers.toArray(new String[numbers.size()]);
|
public com.android.mms.ui.RecipientList$Recipient | getSingleRecipient()getSingleRecipient returns the recipient if there is a single recipient. In all other cases,
it returns null.
int count = mRecipients.size();
if (count != 1) {
return null;
}
return mRecipients.get(0);
|
public java.lang.String | getSingleRecipientNumber()
Recipient first = getSingleRecipient();
if (first == null) {
return null;
}
return first.number;
|
public java.lang.String[] | getToNumbers()
ArrayList<String> numbers = new ArrayList<String>();
int count = mRecipients.size();
for (int i = 0 ; i < count ; i++) {
Recipient recipient = mRecipients.get(i);
if (!recipient.bcc && !TextUtils.isEmpty(recipient.number)) {
numbers.add(recipient.number);
}
}
return numbers.toArray(new String[numbers.size()]);
|
public boolean | hasInvalidRecipient()
return !mInvalidRecipients.isEmpty();
|
public boolean | hasValidRecipient()
return !mRecipients.isEmpty();
|
public java.util.Iterator | iterator() return mRecipients.iterator();
|
public java.lang.String | serialize()
StringBuilder sb = new StringBuilder();
int count = mRecipients.size();
for (int i = 0 ; i < count ; i++) {
if (i != 0) {
sb.append(MessageSender.RECIPIENTS_SEPARATOR);
}
Recipient recipient = mRecipients.get(i);
if (recipient.bcc) {
sb.append("%bcc%");
}
sb.append(recipient.number);
}
return sb.toString();
|
public int | size() return mRecipients.size();
|