当前位置: 首页>>代码示例>>Java>>正文


Java Rfc822Token类代码示例

本文整理汇总了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;
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:27,代码来源:Address.java

示例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();
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:19,代码来源:EmailAddressAdapter.java

示例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;
}
 
开发者ID:jianliaoim,项目名称:talk-android,代码行数:27,代码来源:RecipientEditTextView.java

示例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;
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:17,代码来源:ckm.java

示例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;
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:22,代码来源:cdo.java

示例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;
    }
}
 
开发者ID:daxslab,项目名称:daxSmail,代码行数:27,代码来源:Address.java

示例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;
}
 
开发者ID:CommonQ,项目名称:sms_DualCard,代码行数:17,代码来源:RecipientsEditor.java

示例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();
    }
}
 
开发者ID:CommonQ,项目名称:sms_DualCard,代码行数:23,代码来源:RecipientEditTextView.java

示例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;
}
 
开发者ID:AndroidDeveloperLB,项目名称:ChipsLibrary,代码行数:26,代码来源:RecipientEditTextView.java

示例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;
}
 
开发者ID:x7hub,项目名称:Calendar_lunar,代码行数:21,代码来源:EditEventHelper.java

示例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);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:21,代码来源:Address.java

示例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;
}
 
开发者ID:jianliaoim,项目名称:talk-android,代码行数:8,代码来源:RecipientEditTextView.java

示例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();
    }
}
 
开发者ID:jianliaoim,项目名称:talk-android,代码行数:15,代码来源:RecipientEditTextView.java

示例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 */);
}
 
开发者ID:jianliaoim,项目名称:talk-android,代码行数:14,代码来源:RecipientEntry.java

示例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();
    }
}
 
开发者ID:jianliaoim,项目名称:talk-android,代码行数:12,代码来源:BaseRecipientAdapter.java


注:本文中的android.text.util.Rfc822Token类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。