本文整理汇总了Java中android.text.util.Rfc822Token类的典型用法代码示例。如果您正苦于以下问题:Java Rfc822Token类的具体用法?Java Rfc822Token怎么用?Java Rfc822Token使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Rfc822Token类属于android.text.util包,在下文中一共展示了Rfc822Token类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: convertToString
import android.text.util.Rfc822Token; //导入依赖的package包/类
@Override
public final String convertToString(Cursor cursor) {
int POST_HONEYCOMB_NAME_INDEX = cursor.getColumnIndex(HoneycombMR1Util.getDisplayName());
int POST_HONEYCOMB_EMAIL_INDEX = cursor.getColumnIndex(HoneycombMR1Util.getEmailAddress());
String name = "";
String address = "";
if (SdkLevel.getLevel() >= SdkLevel.LEVEL_HONEYCOMB_MR1) {
name = cursor.getString(POST_HONEYCOMB_NAME_INDEX);
address = cursor.getString(POST_HONEYCOMB_EMAIL_INDEX);
} else {
name = cursor.getString(PRE_HONEYCOMB_NAME_INDEX);
address = cursor.getString(PRE_HONEYCOMB_DATA_INDEX);
}
return new Rfc822Token(name, address, null).toString();
}
示例3: createAddressText
import android.text.util.Rfc822Token; //导入依赖的package包/类
String createAddressText(RecipientEntry entry) {
String display = entry.getDisplayName();
String address = entry.getDestination();
if (TextUtils.isEmpty(display) || TextUtils.equals(display, address)) {
display = null;
}
String trimmedDisplayText;
if (isPhoneQuery() && isPhoneNumber(address)) {
trimmedDisplayText = address.trim();
} else {
if (address != null) {
// Tokenize out the address in case the address already
// contained the username as well.
Rfc822Token[] tokenized = Rfc822Tokenizer.tokenize(address);
if (tokenized != null && tokenized.length > 0) {
address = tokenized[0].getAddress();
}
}
Rfc822Token token = new Rfc822Token(display, address, null);
trimmedDisplayText = token.toString().trim();
}
int index = trimmedDisplayText.indexOf(",");
return mTokenizer != null && !TextUtils.isEmpty(trimmedDisplayText)
&& index < trimmedDisplayText.length() - 1 ? (String) mTokenizer
.terminateToken(trimmedDisplayText) : trimmedDisplayText;
}
示例4: l
import android.text.util.Rfc822Token; //导入依赖的package包/类
private final String l()
{
if (TextUtils.isEmpty(this.o)) {}
String str;
do
{
Rfc822Token[] arrayOfRfc822Token;
do
{
return null;
arrayOfRfc822Token = Rfc822Tokenizer.tokenize(this.o);
} while ((arrayOfRfc822Token == null) || (arrayOfRfc822Token.length <= 0));
str = arrayOfRfc822Token[0].getAddress();
} while ((TextUtils.isEmpty(str)) || (!E.matcher(str).matches()));
return str;
}
示例5: b
import android.text.util.Rfc822Token; //导入依赖的package包/类
public final void b(String paramString)
{
Rfc822Token[] arrayOfRfc822Token = null;
if (paramString != null) {
arrayOfRfc822Token = Rfc822Tokenizer.tokenize(paramString);
}
if ((arrayOfRfc822Token == null) || (arrayOfRfc822Token.length == 0)) {
return;
}
Rfc822Token localRfc822Token = arrayOfRfc822Token[0];
if ((TextUtils.isEmpty(localRfc822Token.getName())) && (!TextUtils.isEmpty(this.b.Z))) {
localRfc822Token.setName(this.b.Z);
}
String str1 = String.valueOf(Uri.encode(localRfc822Token.toString()));
if (str1.length() != 0) {}
for (String str2 = "mailto:".concat(str1);; str2 = new String("mailto:"))
{
f(new Intent("android.intent.action.SENDTO", Uri.parse(str2)));
return;
}
}
示例6: 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;
}
}
示例7: getNumberAt
import android.text.util.Rfc822Token; //导入依赖的package包/类
private static String getNumberAt(Spanned sp, int start, int end, Context context) {
String number = getFieldAt("number", sp, start, end, context);
number = PhoneNumberUtils.replaceUnicodeDigits(number);
if (!TextUtils.isEmpty(number)) {
int pos = number.indexOf('<');
if (pos >= 0 && pos < number.indexOf('>')) {
// The number looks like an Rfc882 address, i.e. <fred flinstone> 891-7823
Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(number);
if (tokens.length == 0) {
return number;
}
return tokens[0].getAddress();
}
}
return number;
}
示例8: createChipDisplayText
import android.text.util.Rfc822Token; //导入依赖的package包/类
String createChipDisplayText(RecipientEntry entry) {
String display = entry.getDisplayName();
String address = entry.getDestination();
if (TextUtils.isEmpty(display) || TextUtils.equals(display, address)) {
display = null;
}
if (address != null && !(isPhoneQuery() && isPhoneNumber(address))) {
// Tokenize out the address in case the address already
// contained the username as well.
Rfc822Token[] tokenized = Rfc822Tokenizer.tokenize(address);
if (tokenized != null && tokenized.length > 0) {
address = tokenized[0].getAddress();
}
}
if (!TextUtils.isEmpty(display)) {
return display;
} else if (!TextUtils.isEmpty(address)){
return address;
} else {
return new Rfc822Token(display, address, null).toString();
}
}
示例9: createAddressText
import android.text.util.Rfc822Token; //导入依赖的package包/类
String createAddressText(final RecipientEntry entry)
{
String display=entry.getDisplayName();
String address=entry.getDestination();
if(TextUtils.isEmpty(display)||TextUtils.equals(display,address))
display=null;
String trimmedDisplayText;
if(isPhoneQuery()&&isPhoneNumber(address))
trimmedDisplayText=address.trim();
else
{
if(address!=null)
{
// Tokenize out the address in case the address already
// contained the username as well.
final Rfc822Token[] tokenized=Rfc822Tokenizer.tokenize(address);
if(tokenized!=null&&tokenized.length>0)
address=tokenized[0].getAddress();
}
final Rfc822Token token=new Rfc822Token(display,address,null);
trimmedDisplayText=token.toString().trim();
}
final int index=trimmedDisplayText.indexOf(",");
return mTokenizer!=null&&!TextUtils.isEmpty(trimmedDisplayText)&&index<trimmedDisplayText.length()-1 ? (String)mTokenizer.terminateToken(trimmedDisplayText) : trimmedDisplayText;
}
示例10: getAddressesFromList
import android.text.util.Rfc822Token; //导入依赖的package包/类
public static LinkedHashSet<Rfc822Token> getAddressesFromList(String list,
Rfc822Validator validator) {
LinkedHashSet<Rfc822Token> addresses = new LinkedHashSet<Rfc822Token>();
Rfc822Tokenizer.tokenize(list, addresses);
if (validator == null) {
return addresses;
}
// validate the emails, out of paranoia. they should already be
// validated on input, but drop any invalid emails just to be safe.
Iterator<Rfc822Token> addressIterator = addresses.iterator();
while (addressIterator.hasNext()) {
Rfc822Token address = addressIterator.next();
if (!validator.isValid(address.getAddress())) {
Log.v(TAG, "Dropping invalid attendee email address: " + address.getAddress());
addressIterator.remove();
}
}
return addresses;
}
示例11: 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);
}
示例12: tokenizeAddress
import android.text.util.Rfc822Token; //导入依赖的package包/类
private static String tokenizeAddress(String destination) {
Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(destination);
if (tokens != null && tokens.length > 0) {
return tokens[0].getAddress();
}
return destination;
}
示例13: createChipDisplayText
import android.text.util.Rfc822Token; //导入依赖的package包/类
String createChipDisplayText(RecipientEntry entry) {
String display = entry.getDisplayName();
String address = entry.getDestination();
if (TextUtils.isEmpty(display) || TextUtils.equals(display, address)) {
display = null;
}
if (!TextUtils.isEmpty(display)) {
return display;
} else if (!TextUtils.isEmpty(address)) {
return address;
} else {
return new Rfc822Token(display, address, null).toString();
}
}
示例14: constructFakeEntry
import android.text.util.Rfc822Token; //导入依赖的package包/类
/**
* Construct a RecipientEntry from just an address that has been entered.
* This address has not been resolved to a contact and therefore does not
* have a contact id or photo.
*/
public static RecipientEntry constructFakeEntry(final String address, final boolean isValid) {
final Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(address);
final String tokenizedAddress = tokens.length > 0 ? tokens[0].getAddress() : address;
return new RecipientEntry(ENTRY_TYPE_PERSON, tokenizedAddress, tokenizedAddress,
INVALID_DESTINATION_TYPE, null, INVALID_CONTACT, null /* directoryId */,
INVALID_CONTACT, null, true, isValid, null /* lookupKey */);
}
示例15: convertResultToString
import android.text.util.Rfc822Token; //导入依赖的package包/类
@Override
public CharSequence convertResultToString(Object resultValue) {
final RecipientEntry entry = (RecipientEntry)resultValue;
final String displayName = entry.getDisplayName();
final String emailAddress = entry.getDestination();
if (TextUtils.isEmpty(displayName) || TextUtils.equals(displayName, emailAddress)) {
return emailAddress;
} else {
return new Rfc822Token(displayName, emailAddress, null).toString();
}
}