use of android.text.util.Rfc822Tokenizer in project android_frameworks_base by ParanoidAndroid.
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));
}
use of android.text.util.Rfc822Tokenizer in project android_frameworks_base by DirtyUnicorns.
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));
}
use of android.text.util.Rfc822Tokenizer in project platform_frameworks_base by android.
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));
}
use of android.text.util.Rfc822Tokenizer in project android_frameworks_base by crdroidandroid.
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));
}
use of android.text.util.Rfc822Tokenizer in project instructure-android by instructure.
the class AddMessageFragment method onReadySetGo.
@Override
protected void onReadySetGo(AddMessagePresenter presenter) {
setupToolbar();
// Set conversation subject
if (!isNewMessage && !mIsMessageStudentsWho) {
mSubject.setText(presenter.getConversation().getSubject());
} else if (mIsMessageStudentsWho) {
if (mIsPersonalMessage) {
mSubject.setVisibility(View.GONE);
mEditSubject.setVisibility(View.VISIBLE);
mEditSubject.setText(getArguments().getString(MESSAGE_STUDENTS_WHO_SUBJECT));
} else {
mSubject.setText(getArguments().getString(MESSAGE_STUDENTS_WHO_SUBJECT));
}
}
// Set up recipients view
mChipsTextView.setTokenizer(new Rfc822Tokenizer());
if (mChipsAdapter == null) {
mChipsAdapter = new RecipientAdapter(getContext());
}
if (mChipsTextView.getAdapter() == null) {
mChipsTextView.setAdapter(mChipsAdapter);
}
if (getPresenter().getCourse().getId() != 0) {
mChipsAdapter.getCanvasRecipientManager().setCanvasContext(getPresenter().getCourse());
} else if (mSelectedCourse != null) {
courseWasSelected();
mChipsAdapter.getCanvasRecipientManager().setCanvasContext(mSelectedCourse);
}
ColorUtils.colorIt(ThemePrefs.getButtonColor(), mContactsButton);
// don't show the contacts button if there is no selected course and there is no context_code from the conversation (shouldn't happen, but it does)
if (mSelectedCourse == null && getPresenter().getCourse() != null && getPresenter().getCourse().getId() == 0) {
mContactsButton.setVisibility(View.INVISIBLE);
}
mContactsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CanvasContext canvasContext;
if (getPresenter().getCourse() != null && getPresenter().getCourse().getId() == 0) {
// presenter doesn't know what the course is, use the mSelectedCourse instead
canvasContext = mSelectedCourse;
} else {
canvasContext = getPresenter().getCourse();
}
RouteMatcher.route(getContext(), new Route(ChooseRecipientsFragment.class, canvasContext, ChooseRecipientsFragment.createBundle(canvasContext, getRecipientsFromRecipientEntries())));
}
});
// Ensure attachments are up to date
refreshAttachments();
// get courses and groups if this is a new compose message
if (isNewMessage) {
getPresenter().getAllCoursesAndGroups(true);
}
}
Aggregations