本文整理汇总了Java中android.text.util.Rfc822Token.getAddress方法的典型用法代码示例。如果您正苦于以下问题:Java Rfc822Token.getAddress方法的具体用法?Java Rfc822Token.getAddress怎么用?Java Rfc822Token.getAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.text.util.Rfc822Token
的用法示例。
在下文中一共展示了Rfc822Token.getAddress方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Address
import android.text.util.Rfc822Token; //导入方法依赖的package包/类
private Address(String address, String personal, boolean parse) {
if (parse) {
Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(address);
if (tokens.length > 0) {
Rfc822Token token = tokens[0];
mAddress = token.getAddress();
String name = token.getName();
if (!TextUtils.isEmpty(name)) {
/*
* Don't use the "personal" argument if "address" is of the form:
* James Bond <[email protected]>
*
* See issue 2920
*/
mPersonal = name;
} else {
mPersonal = (personal == null) ? null : personal.trim();
}
} else {
// This should be an error
}
} else {
mAddress = address;
mPersonal = personal;
}
}
示例2: Address
import android.text.util.Rfc822Token; //导入方法依赖的package包/类
private Address(String address, String personal, boolean parse) {
if (parse) {
Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(address);
if (tokens.length > 0) {
Rfc822Token token = tokens[0];
mAddress = token.getAddress();
String name = token.getName();
if (!StringUtils.isNullOrEmpty(name)) {
/*
* Don't use the "personal" argument if "address" is of the form:
* James Bond <[email protected]>
*
* See issue 2920
*/
mPersonal = name;
} else {
mPersonal = (personal == null) ? null : personal.trim();
}
} else {
// This should be an error
}
} else {
mAddress = address;
mPersonal = personal;
}
}
示例3: parseUnencoded
import android.text.util.Rfc822Token; //导入方法依赖的package包/类
/**
* Parse a comma separated list of email addresses in human readable format and return an
* array of Address objects, RFC-822 encoded.
*
* @param addressList
* @return An array of 0 or more Addresses.
*/
public static Address[] parseUnencoded(String addressList) {
List<Address> addresses = new ArrayList<Address>();
if (!TextUtils.isEmpty(addressList)) {
Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(addressList);
for (Rfc822Token token : tokens) {
String address = token.getAddress();
if (!TextUtils.isEmpty(address)) {
addresses.add(new Address(token.getAddress(), token.getName(), false));
}
}
}
return addresses.toArray(EMPTY_ADDRESS_ARRAY);
}
示例4: parseUnencoded
import android.text.util.Rfc822Token; //导入方法依赖的package包/类
/**
* Parse a comma separated list of email addresses in human readable format and return an
* array of Address objects, RFC-822 encoded.
*
* @param addressList
* @return An array of 0 or more Addresses.
*/
public static Address[] parseUnencoded(String addressList) {
List<Address> addresses = new ArrayList<Address>();
if (!StringUtils.isNullOrEmpty(addressList)) {
Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(addressList);
for (Rfc822Token token : tokens) {
String address = token.getAddress();
if (!StringUtils.isNullOrEmpty(address)) {
addresses.add(new Address(token.getAddress(), token.getName(), false));
}
}
}
return addresses.toArray(EMPTY_ADDRESS_ARRAY);
}
示例5: inviteBuddies
import android.text.util.Rfc822Token; //导入方法依赖的package包/类
void inviteBuddies() {
Rfc822Token[] recipients = Rfc822Tokenizer.tokenize(mNewAddress.getText());
Pattern pattern = Pattern.compile(EMAIL_PATTERN);
boolean foundOne = false;
for (Rfc822Token recipient : recipients) {
String address = recipient.getAddress();
if (pattern.matcher(address).matches()) {
new AddContactAsyncTask(mApp.getDefaultProviderId(), mApp.getDefaultAccountId(), mApp).execute(address, null, null);
foundOne = true;
}
}
if (foundOne) {
Intent intent = new Intent();
intent.putExtra(ContactsPickerActivity.EXTRA_RESULT_USERNAME, recipients[0].getAddress());
intent.putExtra(ContactsPickerActivity.EXTRA_RESULT_PROVIDER, mApp.getDefaultProviderId());
setResult(RESULT_OK, intent);
finish();
}
}
示例6: parseUnencoded
import android.text.util.Rfc822Token; //导入方法依赖的package包/类
public static Address[] parseUnencoded(String addressList) {
List<Address> addresses = new ArrayList<Address>();
if (addressList!=null
&& !"".equals(addressList)) {
Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(addressList);
for (Rfc822Token token : tokens) {
String address = token.getAddress();
if (address!=null
&& !"".equals(address)) {
addresses.add(new Address(token.getAddress(), token.getName()));
}
}
}
return addresses.toArray(new Address[0]);
}
示例7: inviteBuddies
import android.text.util.Rfc822Token; //导入方法依赖的package包/类
void inviteBuddies() {
Rfc822Token[] recipients = Rfc822Tokenizer.tokenize(mAddressList.getText());
try {
IImConnection conn = mApp.getConnection(mProviderId);
IContactList list = getContactList(conn);
if (list == null) {
Log.e(ImApp.LOG_TAG, "<AddContactActivity> can't find given contact list:"
+ getSelectedListName());
finish();
} else {
boolean fail = false;
for (Rfc822Token recipient : recipients) {
String username = recipient.getAddress();
if (mDefaultDomain != null && username.indexOf('@') == -1) {
username = username + "@" + mDefaultDomain;
}
if (Log.isLoggable(ImApp.LOG_TAG, Log.DEBUG)) {
log("addContact:" + username);
}
int res = list.addContact(username);
if (res != ImErrorInfo.NO_ERROR) {
fail = true;
mHandler.showAlert(R.string.error,
ErrorResUtils.getErrorRes(getResources(), res, username));
}
}
// close the screen if there's no error.
if (!fail) {
finish();
}
}
} catch (RemoteException ex) {
Log.e(ImApp.LOG_TAG, "<AddContactActivity> inviteBuddies: caught " + ex);
}
}
示例8: addAttendees
import android.text.util.Rfc822Token; //导入方法依赖的package包/类
public void addAttendees(String attendees) {
final LinkedHashSet<Rfc822Token> addresses =
EditEventHelper.getAddressesFromList(attendees, mValidator);
synchronized (this) {
for (final Rfc822Token address : addresses) {
final Attendee attendee = new Attendee(address.getName(), address.getAddress());
if (TextUtils.isEmpty(attendee.mName)) {
attendee.mName = attendee.mEmail;
}
addOneAttendee(attendee);
}
}
}
示例9: addAttendees
import android.text.util.Rfc822Token; //导入方法依赖的package包/类
public void addAttendees(String attendees, Rfc822Validator validator) {
final LinkedHashSet<Rfc822Token> addresses = EditEventHelper.getAddressesFromList(
attendees, validator);
synchronized (this) {
for (final Rfc822Token address : addresses) {
final Attendee attendee = new Attendee(address.getName(), address.getAddress());
if (TextUtils.isEmpty(attendee.mName)) {
attendee.mName = attendee.mEmail;
}
addAttendee(attendee);
}
}
}