use of com.android.mms.data.ContactList in project android-aosp-mms by slvn.
the class ComposeMessageActivity method launchMultiplePhonePicker.
private void launchMultiplePhonePicker() {
Intent intent = new Intent(Intents.ACTION_GET_MULTIPLE_PHONES);
intent.addCategory("android.intent.category.DEFAULT");
intent.setType(Phone.CONTENT_TYPE);
// We have to wait for the constructing complete.
ContactList contacts = mRecipientsEditor.constructContactsFromInput(true);
int urisCount = 0;
Uri[] uris = new Uri[contacts.size()];
urisCount = 0;
for (Contact contact : contacts) {
if (Contact.CONTACT_METHOD_TYPE_PHONE == contact.getContactMethodType()) {
uris[urisCount++] = contact.getPhoneUri();
}
}
if (urisCount > 0) {
intent.putExtra(Intents.EXTRA_PHONE_URIS, uris);
}
startActivityForResult(intent, REQUEST_CODE_PICK);
}
use of com.android.mms.data.ContactList in project android-aosp-mms by slvn.
the class ComposeMessageActivity method confirmSendMessageIfNeeded.
private void confirmSendMessageIfNeeded() {
if (!isRecipientsEditorVisible()) {
sendMessage(true);
return;
}
boolean isMms = mWorkingMessage.requiresMms();
if (mRecipientsEditor.hasInvalidRecipient(isMms)) {
if (mRecipientsEditor.hasValidRecipient(isMms)) {
String title = getResourcesString(R.string.has_invalid_recipient, mRecipientsEditor.formatInvalidNumbers(isMms));
new AlertDialog.Builder(this).setTitle(title).setMessage(R.string.invalid_recipient_message).setPositiveButton(R.string.try_to_send, new SendIgnoreInvalidRecipientListener()).setNegativeButton(R.string.no, new CancelSendingListener()).show();
} else {
new AlertDialog.Builder(this).setTitle(R.string.cannot_send_message).setMessage(R.string.cannot_send_message_reason).setPositiveButton(R.string.yes, new CancelSendingListener()).show();
}
} else {
// The recipients editor is still open. Make sure we use what's showing there
// as the destination.
ContactList contacts = mRecipientsEditor.constructContactsFromInput(false);
mDebugRecipients = contacts.serialize();
sendMessage(true);
}
}
use of com.android.mms.data.ContactList in project android-aosp-mms by slvn.
the class ConversationListItem method bind.
public final void bind(Context context, final Conversation conversation) {
// if (DEBUG) Log.v(TAG, "bind()");
mConversation = conversation;
updateBackground();
LayoutParams attachmentLayout = (LayoutParams) mAttachmentView.getLayoutParams();
boolean hasError = conversation.hasError();
// As far as I know, there's no way to specify that relationship in xml.
if (hasError) {
attachmentLayout.addRule(RelativeLayout.LEFT_OF, R.id.error);
} else {
attachmentLayout.addRule(RelativeLayout.LEFT_OF, R.id.date);
}
boolean hasAttachment = conversation.hasAttachment();
mAttachmentView.setVisibility(hasAttachment ? VISIBLE : GONE);
// Date
mDateView.setText(MessageUtils.formatTimeStampString(context, conversation.getDate()));
// From.
mFromView.setText(formatMessage());
// Register for updates in changes of any of the contacts in this conversation.
ContactList contacts = conversation.getRecipients();
if (Log.isLoggable(LogTag.CONTACT, Log.DEBUG)) {
Log.v(TAG, "bind: contacts.addListeners " + this);
}
Contact.addListener(this);
// Subject
mSubjectView.setText(conversation.getSnippet());
LayoutParams subjectLayout = (LayoutParams) mSubjectView.getLayoutParams();
// We have to make the subject left of whatever optional items are shown on the right.
subjectLayout.addRule(RelativeLayout.LEFT_OF, hasAttachment ? R.id.attachment : (hasError ? R.id.error : R.id.date));
// Transmission error indicator.
mErrorIndicator.setVisibility(hasError ? VISIBLE : GONE);
updateAvatarView();
}
use of com.android.mms.data.ContactList in project android-aosp-mms by slvn.
the class RecipientsEditor method constructContactsFromInput.
public ContactList constructContactsFromInput(boolean blocking) {
List<String> numbers = mTokenizer.getNumbers();
ContactList list = new ContactList();
for (String number : numbers) {
Contact contact = Contact.get(number, blocking);
contact.setNumber(number);
list.add(contact);
}
return list;
}
use of com.android.mms.data.ContactList in project android-aosp-mms by slvn.
the class ComposeMessageActivityTests method testCreateManyThreads.
// Here's how to execute just this one test:
// runtest -m testCreateManyThreads mms -c com.android.mms.ui.ComposeMessageActivityTests
// This test intentionally uses the UI functions to create the threads rather than adding
// the threads directly to the mms provider's threads table.
@LargeTest
public void testCreateManyThreads() {
for (int i = 0; i < 10; i++) {
String phoneNum = String.format("424-123-%04d", i);
ContactList contactList = ContactList.getByNumbers(phoneNum, false, false);
Conversation conv = Conversation.get(mActivity, contactList, false);
WorkingMessage workingMsg = WorkingMessage.loadDraft(mActivity, conv, null);
workingMsg.setConversation(conv);
workingMsg.setText("This is test #" + i + " thread id: " + conv.getThreadId());
// Log.i(TAG, "[testCreateManyThreads] workingMsg: ");
// workingMsg.dump();
workingMsg.saveDraft(false);
}
}
Aggregations