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


Java PhoneNumberUtils.isWellFormedSmsAddress方法代码示例

本文整理汇总了Java中android.telephony.PhoneNumberUtils.isWellFormedSmsAddress方法的典型用法代码示例。如果您正苦于以下问题:Java PhoneNumberUtils.isWellFormedSmsAddress方法的具体用法?Java PhoneNumberUtils.isWellFormedSmsAddress怎么用?Java PhoneNumberUtils.isWellFormedSmsAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.telephony.PhoneNumberUtils的用法示例。


在下文中一共展示了PhoneNumberUtils.isWellFormedSmsAddress方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isValidAddress

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
private boolean isValidAddress(String number, boolean isMms) {
    /*if (isMms) {
        return MessageUtils.isValidMmsAddress(number);
    } else {*/
        // TODO: PhoneNumberUtils.isWellFormedSmsAddress() only check if the number is a valid
        // GSM SMS address. If the address contains a dialable char, it considers it a well
        // formed SMS addr. CDMA doesn't work that way and has a different parser for SMS
        // address (see CdmaSmsAddress.parse(String address)). We should definitely fix this!!!
    return PhoneNumberUtils.isWellFormedSmsAddress(number);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:11,代码来源:RecipientsEditor.java

示例2: isNumberAddress

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
@VisibleForTesting
static boolean isNumberAddress(@NonNull String number) {
  if (number.contains("@"))             return false;
  if (GroupUtil.isEncodedGroup(number)) return false;

  final String networkNumber = PhoneNumberUtils.extractNetworkPortion(number);

  if (TextUtils.isEmpty(networkNumber)) return false;
  if (networkNumber.length() < 3)       return false;

  return PhoneNumberUtils.isWellFormedSmsAddress(number);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:13,代码来源:CanonicalAddressDatabase.java

示例3: parseBracketedNumber

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
private static String parseBracketedNumber(String recipient) throws RecipientFormattingException {
  int begin    = recipient.indexOf('<');
  int end      = recipient.indexOf('>');
  String value = recipient.substring(begin + 1, end);

  if (PhoneNumberUtils.isWellFormedSmsAddress(value))
    return value;
  else
    throw new RecipientFormattingException("Bracketed value: " + value + " is not valid.");
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:11,代码来源:RecipientsFormatter.java

示例4: parseRecipient

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
private static String parseRecipient(String recipient) throws RecipientFormattingException {
  recipient = recipient.trim();

  if ((recipient.indexOf('<') != -1) && (recipient.indexOf('>') != -1))
    return parseBracketedNumber(recipient);

  if (PhoneNumberUtils.isWellFormedSmsAddress(recipient))
    return recipient;

  throw new RecipientFormattingException("Recipient: " + recipient + " is badly formatted.");
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:12,代码来源:RecipientsFormatter.java

示例5: isNumberAddress

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
@VisibleForTesting
static boolean isNumberAddress(String number) {
  if (number.contains("@"))
    return false;
  if (GroupUtil.isEncodedGroup(number))
    return false;

  final String networkNumber = PhoneNumberUtils.extractNetworkPortion(number);
  if (TextUtils.isEmpty(networkNumber))
    return false;
  if (networkNumber.length() < 3)
    return false;

  return PhoneNumberUtils.isWellFormedSmsAddress(number);
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:16,代码来源:CanonicalAddressDatabase.java

示例6: isValid

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
@SuppressWarnings({"SimplifiableIfStatement", "RedundantIfStatement"})
@Override
public boolean isValid() {
    if (Utils.isBlank(sms.destination))
        return false;
    if (!PhoneNumberUtils.isWellFormedSmsAddress(sms.destination))
        return false;
    if (Utils.isBlank(sms.content))
        return false;
    return true;
}
 
开发者ID:renyuneyun,项目名称:Easer,代码行数:12,代码来源:SmsOperationData.java

示例7: getCursorForRecipientFilter

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
/***
 * If the code below looks shitty to you, that's because it was taken
 * directly from the Android source, where shitty code is all you get.
 */

public Cursor getCursorForRecipientFilter(CharSequence constraint,
    ContentResolver mContentResolver)
{
  final String SORT_ORDER = Contacts.TIMES_CONTACTED + " DESC," +
                            Contacts.DISPLAY_NAME + "," +
                            Contacts.Data.IS_SUPER_PRIMARY + " DESC," +
                            Phone.TYPE;

  final String[] PROJECTION_PHONE = {
      Phone._ID,                  // 0
      Phone.CONTACT_ID,           // 1
      Phone.TYPE,                 // 2
      Phone.NUMBER,               // 3
      Phone.LABEL,                // 4
      Phone.DISPLAY_NAME,         // 5
  };

  String phone = "";
  String cons  = null;

  if (constraint != null) {
    cons = constraint.toString();

    if (RecipientsAdapter.usefulAsDigits(cons)) {
      phone = PhoneNumberUtils.convertKeypadLettersToDigits(cons);
      if (phone.equals(cons) && !PhoneNumberUtils.isWellFormedSmsAddress(phone)) {
        phone = "";
      } else {
        phone = phone.trim();
      }
    }
  }
  Uri uri = Uri.withAppendedPath(Phone.CONTENT_FILTER_URI, Uri.encode(cons));
  String selection = String.format("%s=%s OR %s=%s OR %s=%s",
                                   Phone.TYPE,
                                   Phone.TYPE_MOBILE,
                                   Phone.TYPE,
                                   Phone.TYPE_WORK_MOBILE,
                                   Phone.TYPE,
                                   Phone.TYPE_MMS);

  Cursor phoneCursor = mContentResolver.query(uri,
                                              PROJECTION_PHONE,
                                              null,
                                              null,
                                              SORT_ORDER);

  if (phone.length() > 0) {
    ArrayList result = new ArrayList();
    result.add(Integer.valueOf(-1));                    // ID
    result.add(Long.valueOf(-1));                       // CONTACT_ID
    result.add(Integer.valueOf(Phone.TYPE_CUSTOM));     // TYPE
    result.add(phone);                                  // NUMBER

  /*
  * The "\u00A0" keeps Phone.getDisplayLabel() from deciding
  * to display the default label ("Home") next to the transformation
  * of the letters into numbers.
  */
    result.add("\u00A0");                               // LABEL
    result.add(cons);                                   // NAME

    ArrayList<ArrayList> wrap = new ArrayList<ArrayList>();
    wrap.add(result);

    ArrayListCursor translated = new ArrayListCursor(PROJECTION_PHONE, wrap);

    return new MergeCursor(new Cursor[] { translated, phoneCursor });
  } else {
    return phoneCursor;
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:78,代码来源:ContactAccessor.java

示例8: isValidSmsOrEmail

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
public static boolean isValidSmsOrEmail(String number) {
  return PhoneNumberUtils.isWellFormedSmsAddress(number) || isValidEmail(number);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:4,代码来源:NumberUtil.java

示例9: isValidSmsOrEmailOrGroup

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
public static boolean isValidSmsOrEmailOrGroup(String number) {
  return PhoneNumberUtils.isWellFormedSmsAddress(number) ||
      isValidEmail(number) ||
      GroupUtil.isEncodedGroup(number);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:6,代码来源:NumberUtil.java


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