Search in sources :

Example 6 with Rfc822Tokenizer

use of android.text.util.Rfc822Tokenizer in project j2objc by google.

the class TextUtilsTest method testRfc822FindToken.

@SmallTest
public void testRfc822FindToken() {
    Rfc822Tokenizer tokenizer = new Rfc822Tokenizer();
    // 0           1         2           3         4
    // 0 1234 56789012345678901234 5678 90123456789012345
    String address = "\"Foo\" <foo@google.com>, \"Bar\" <bar@google.com>";
    assertEquals(0, tokenizer.findTokenStart(address, 21));
    assertEquals(22, tokenizer.findTokenEnd(address, 21));
    assertEquals(24, tokenizer.findTokenStart(address, 25));
    assertEquals(46, tokenizer.findTokenEnd(address, 25));
}
Also used : Rfc822Tokenizer(android.text.util.Rfc822Tokenizer) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 7 with Rfc822Tokenizer

use of android.text.util.Rfc822Tokenizer in project Etar-Calendar by Etar-Group.

the class EditEventView method initMultiAutoCompleteTextView.

// From com.google.android.gm.ComposeActivity
private MultiAutoCompleteTextView initMultiAutoCompleteTextView(RecipientEditTextView list) {
    if (ChipsUtil.supportsChipsUi()) {
        mAddressAdapter = new RecipientAdapter(mActivity);
        list.setAdapter((BaseRecipientAdapter) mAddressAdapter);
        list.setOnFocusListShrinkRecipients(false);
    } else {
        mAddressAdapter = new EmailAddressAdapter(mActivity);
        list.setAdapter((EmailAddressAdapter) mAddressAdapter);
    }
    list.setTokenizer(new Rfc822Tokenizer());
    list.setValidator(mEmailValidator);
    // NOTE: assumes no other filters are set
    list.setFilters(sRecipientFilters);
    return list;
}
Also used : Rfc822Tokenizer(android.text.util.Rfc822Tokenizer) RecipientAdapter(com.android.calendar.RecipientAdapter) BaseRecipientAdapter(com.android.ex.chips.BaseRecipientAdapter) EmailAddressAdapter(com.android.calendar.EmailAddressAdapter)

Example 8 with Rfc822Tokenizer

use of android.text.util.Rfc822Tokenizer in project android_frameworks_base by AOSPA.

the class TextUtilsTest method testRfc822FindToken.

@SmallTest
public void testRfc822FindToken() {
    Rfc822Tokenizer tokenizer = new Rfc822Tokenizer();
    //                0           1         2           3         4
    //                0 1234 56789012345678901234 5678 90123456789012345
    String address = "\"Foo\" <foo@google.com>, \"Bar\" <bar@google.com>";
    assertEquals(0, tokenizer.findTokenStart(address, 21));
    assertEquals(22, tokenizer.findTokenEnd(address, 21));
    assertEquals(24, tokenizer.findTokenStart(address, 25));
    assertEquals(46, tokenizer.findTokenEnd(address, 25));
}
Also used : Rfc822Tokenizer(android.text.util.Rfc822Tokenizer) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 9 with Rfc822Tokenizer

use of android.text.util.Rfc822Tokenizer in project android_frameworks_base by ResurrectionRemix.

the class TextUtilsTest method testRfc822FindToken.

@SmallTest
public void testRfc822FindToken() {
    Rfc822Tokenizer tokenizer = new Rfc822Tokenizer();
    //                0           1         2           3         4
    //                0 1234 56789012345678901234 5678 90123456789012345
    String address = "\"Foo\" <foo@google.com>, \"Bar\" <bar@google.com>";
    assertEquals(0, tokenizer.findTokenStart(address, 21));
    assertEquals(22, tokenizer.findTokenEnd(address, 21));
    assertEquals(24, tokenizer.findTokenStart(address, 25));
    assertEquals(46, tokenizer.findTokenEnd(address, 25));
}
Also used : Rfc822Tokenizer(android.text.util.Rfc822Tokenizer) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 10 with Rfc822Tokenizer

use of android.text.util.Rfc822Tokenizer in project instructure-android by instructure.

the class AddMessageFragment method addRecipients.

private void addRecipients(ArrayList<Recipient> newRecipients) {
    List<RecipientEntry> selectedRecipients = mChipsTextView.getSelectedRecipients();
    mChipsTextView.setTokenizer(new Rfc822Tokenizer());
    if (mChipsAdapter == null) {
        mChipsAdapter = new RecipientAdapter(getContext());
    }
    if (mChipsTextView.getAdapter() == null) {
        mChipsTextView.setAdapter(mChipsAdapter);
    }
    addRecipient: for (Recipient recipient : newRecipients) {
        // Skip if this recipient is already added
        for (RecipientEntry entry : selectedRecipients) {
            if (entry.getDestination().equals(recipient.getStringId())) {
                continue addRecipient;
            }
        }
        // Create RecipientEntry from Recipient and add to list
        RecipientEntry recipientEntry = new RecipientEntry(recipient.getIdAsLong(), recipient.getName(), recipient.getStringId(), "", recipient.getAvatarURL(), 0, 0, true, recipient.getCommonCourses() != null ? recipient.getCommonCourses().keySet() : null, recipient.getCommonGroups() != null ? recipient.getCommonGroups().keySet() : null);
        mChipsTextView.appendRecipientEntry(recipientEntry);
    }
}
Also used : Rfc822Tokenizer(android.text.util.Rfc822Tokenizer) RecipientAdapter(com.instructure.teacher.adapters.RecipientAdapter) Recipient(com.instructure.canvasapi2.models.Recipient) RecipientEntry(com.android.ex.chips.RecipientEntry)

Aggregations

Rfc822Tokenizer (android.text.util.Rfc822Tokenizer)10 SmallTest (android.test.suitebuilder.annotation.SmallTest)7 RecipientAdapter (com.instructure.teacher.adapters.RecipientAdapter)2 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 ScrollView (android.widget.ScrollView)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 EmailAddressAdapter (com.android.calendar.EmailAddressAdapter)1 RecipientAdapter (com.android.calendar.RecipientAdapter)1 BaseRecipientAdapter (com.android.ex.chips.BaseRecipientAdapter)1 RecipientEditTextView (com.android.ex.chips.RecipientEditTextView)1 RecipientEntry (com.android.ex.chips.RecipientEntry)1 CanvasContext (com.instructure.canvasapi2.models.CanvasContext)1 Recipient (com.instructure.canvasapi2.models.Recipient)1 Route (com.instructure.interactions.router.Route)1 AttachmentView (com.instructure.pandautils.views.AttachmentView)1 AddMessageView (com.instructure.teacher.viewinterface.AddMessageView)1