Search in sources :

Example 6 with Conversation

use of com.android.mms.data.Conversation 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);
    }
}
Also used : WorkingMessage(com.android.mms.data.WorkingMessage) Conversation(com.android.mms.data.Conversation) ContactList(com.android.mms.data.ContactList) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 7 with Conversation

use of com.android.mms.data.Conversation in project android-aosp-mms by slvn.

the class RecipientListActivity method onCreate.

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    if (icicle != null) {
        // Retrieve previously saved state of this activity.
        mThreadId = icicle.getLong(ComposeMessageActivity.THREAD_ID);
    } else {
        mThreadId = getIntent().getLongExtra(ComposeMessageActivity.THREAD_ID, 0);
    }
    if (mThreadId == 0) {
        Log.w(TAG, "No thread_id specified in extras or icicle. Finishing...");
        finish();
        return;
    }
    Conversation conv = Conversation.get(this, mThreadId, true);
    if (conv == null) {
        Log.w(TAG, "No conversation found for threadId: " + mThreadId + ". Finishing...");
        finish();
        return;
    }
    final ContactList contacts = conv.getRecipients();
    getListView().setAdapter(new RecipientListAdapter(this, R.layout.recipient_list_item, contacts));
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    int cnt = contacts.size();
    actionBar.setSubtitle(getResources().getQuantityString(R.plurals.recipient_count, cnt, cnt));
}
Also used : Conversation(com.android.mms.data.Conversation) ContactList(com.android.mms.data.ContactList) ActionBar(android.app.ActionBar)

Aggregations

Conversation (com.android.mms.data.Conversation)7 Cursor (android.database.Cursor)3 ContactList (com.android.mms.data.ContactList)2 ActionBar (android.app.ActionBar)1 Intent (android.content.Intent)1 Uri (android.net.Uri)1 LargeTest (android.test.suitebuilder.annotation.LargeTest)1 Contact (com.android.mms.data.Contact)1 WorkingMessage (com.android.mms.data.WorkingMessage)1