android.telephony.PhoneNumberUtils Java Examples

The following examples show how to use android.telephony.PhoneNumberUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IncomingCallsReceiver.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
private static String bestPhoneNumberFormatter(final String number) {
    if (number == null) return null;
    final String formatted = PhoneNumberUtils.formatNumber(number);
    if (formatted.contains(" ")) {
        return formatted;
    } else {
        final StringBuilder spaced = new StringBuilder();
        final char[] array = number.toCharArray();
        boolean first = true;
        int counter = 0;
        for (char c : array) {
            spaced.append(c);
            first = false;
            counter++;
            if (counter == 5) {
                spaced.append(" ");
            }
        }
        return spaced.toString();
    }
}
 
Example #2
Source File: IncomingCallsReceiver.java    From xDrip-plus with GNU General Public License v3.0 6 votes vote down vote up
private static String bestPhoneNumberFormatter(final String number) {
    if (number == null) return null;
    final String formatted = PhoneNumberUtils.formatNumber(number);
    if (formatted.contains(" ")) {
        return formatted;
    } else {
        final StringBuilder spaced = new StringBuilder();
        final char[] array = number.toCharArray();
        boolean first = true;
        int counter = 0;
        for (char c : array) {
            spaced.append(c);
            first = false;
            counter++;
            if (counter == 5) {
                spaced.append(" ");
            }
        }
        return spaced.toString();
    }
}
 
Example #3
Source File: Social.java    From Android-Commons with Apache License 2.0 6 votes vote down vote up
/**
 * Normalizes the specified phone number to its E.164 representation, if supported by the platform
 *
 * @param context a context reference
 * @param phoneNumber the phone number to normalize
 * @return the normalized phone number
 */
@SuppressLint("NewApi")
public static String normalizePhoneNumber(final Context context, final String phoneNumber) {
	if (Build.VERSION.SDK_INT >= 21) {
		final String countryIso2 = DeviceInfo.getCountryISO2(context);

		if (countryIso2 != null) {
			final String formatted = PhoneNumberUtils.formatNumberToE164(phoneNumber, countryIso2.toUpperCase(Locale.US));

			if (formatted != null) {
				return formatted;
			}
		}
	}

	return phoneNumber;
}
 
Example #4
Source File: ShareActivity.java    From BaldPhone with Apache License 2.0 6 votes vote down vote up
public void whatsappShare(String lookupKey) {
    final Contact contact;
    try {
        contact = Contact.fromLookupKey(lookupKey, contentResolver);
    } catch (Contact.ContactNotFoundException e) {
        Log.e(TAG, S.str(e.getMessage()));
        e.printStackTrace();
        BaldToast.error(this);
        finish();
        return;
    }
    shareIntent.setPackage(D.WHATSAPP_PACKAGE_NAME);
    String smsNumber = PhoneNumberUtils.stripSeparators(contact.getWhatsappNumbers().get(0)).replace("+", "").replace(" ", "");
    shareIntent.putExtra("jid", smsNumber + "@s.whatsapp.net"); //phone number without "+" prefix
    startActivity(shareIntent);
    finish();
}
 
Example #5
Source File: SingleContactActivity.java    From BaldPhone with Apache License 2.0 6 votes vote down vote up
private void inflateWhatsapp() {
    final List<String> whatappNumbers = contact.getWhatsappNumbers();
    for (String whatappNumber : whatappNumbers) {
        final View layout = layoutInflater.inflate(R.layout.contact_whatsapp, ll, false);
        layout.findViewById(R.id.whatsapp).setOnClickListener((v) ->
                startActivity(
                        new Intent("android.intent.activate.MAIN")
                                .setComponent(new ComponentName("com.whatsapp", "com.whatsapp.Conversation"))
                                .putExtra("jid",
                                        PhoneNumberUtils.stripSeparators(
                                                whatappNumber
                                                        .replaceAll(
                                                                "[^0123456789]",
                                                                "")
                                        ) + "@s.whatsapp.net")
                )
        );
        ll.addView(layout);
    }
}
 
Example #6
Source File: CallLog.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private static void updateNormalizedNumber(Context context, ContentResolver resolver,
        String dataId, String number) {
    if (TextUtils.isEmpty(number) || TextUtils.isEmpty(dataId)) {
        return;
    }
    final String countryIso = getCurrentCountryIso(context);
    if (TextUtils.isEmpty(countryIso)) {
        return;
    }
    final String normalizedNumber = PhoneNumberUtils.formatNumberToE164(number,
            getCurrentCountryIso(context));
    if (TextUtils.isEmpty(normalizedNumber)) {
        return;
    }
    final ContentValues values = new ContentValues();
    values.put(Phone.NORMALIZED_NUMBER, normalizedNumber);
    resolver.update(Data.CONTENT_URI, values, Data._ID + "=?", new String[] {dataId});
}
 
Example #7
Source File: Linkify.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private static void gatherTelLinks(ArrayList<LinkSpec> links, Spannable s,
        @Nullable Context context) {
    PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
    final TelephonyManager tm = (context == null)
            ? TelephonyManager.getDefault()
            : TelephonyManager.from(context);
    Iterable<PhoneNumberMatch> matches = phoneUtil.findNumbers(s.toString(),
            tm.getSimCountryIso().toUpperCase(Locale.US),
            Leniency.POSSIBLE, Long.MAX_VALUE);
    for (PhoneNumberMatch match : matches) {
        LinkSpec spec = new LinkSpec();
        spec.url = "tel:" + PhoneNumberUtils.normalizeNumber(match.rawString());
        spec.start = match.start();
        spec.end = match.end();
        links.add(spec);
    }
}
 
Example #8
Source File: VCardContactEncoder.java    From AndroidWebServ with Apache License 2.0 6 votes vote down vote up
@Override
public String[] encode(Iterable<String> names, String organization, Iterable<String> addresses,
        Iterable<String> phones, Iterable<String> emails, Iterable<String> urls, String note) {
    StringBuilder newContents = new StringBuilder(100);
    newContents.append("BEGIN:VCARD").append(TERMINATOR);
    newContents.append("VERSION:3.0").append(TERMINATOR);
    StringBuilder newDisplayContents = new StringBuilder(100);
    appendUpToUnique(newContents, newDisplayContents, "N", names, 1, null);
    append(newContents, newDisplayContents, "ORG", organization);
    appendUpToUnique(newContents, newDisplayContents, "ADR", addresses, 1, null);
    appendUpToUnique(newContents, newDisplayContents, "TEL", phones, Integer.MAX_VALUE,
            new Formatter() {
                @Override
                public String format(String source) {
                    return PhoneNumberUtils.formatNumber(source);
                }
            });
    appendUpToUnique(newContents, newDisplayContents, "EMAIL", emails, Integer.MAX_VALUE, null);
    appendUpToUnique(newContents, newDisplayContents, "URL", urls, Integer.MAX_VALUE, null);
    append(newContents, newDisplayContents, "NOTE", note);
    newContents.append("END:VCARD").append(TERMINATOR);
    return new String[] { newContents.toString(), newDisplayContents.toString() };
}
 
Example #9
Source File: VCardContactEncoder.java    From reacteu-app with MIT License 6 votes vote down vote up
@Override
public String[] encode(Iterable<String> names,
                       String organization,
                       Iterable<String> addresses,
                       Iterable<String> phones,
                       Iterable<String> emails,
                       String url,
                       String note) {
  StringBuilder newContents = new StringBuilder(100);
  StringBuilder newDisplayContents = new StringBuilder(100);
  newContents.append("BEGIN:VCARD").append(TERMINATOR);
  appendUpToUnique(newContents, newDisplayContents, "N", names, 1, null);
  append(newContents, newDisplayContents, "ORG", organization);
  appendUpToUnique(newContents, newDisplayContents, "ADR", addresses, 1, null);
  appendUpToUnique(newContents, newDisplayContents, "TEL", phones, Integer.MAX_VALUE, new Formatter() {
    @Override
    public String format(String source) {
      return PhoneNumberUtils.formatNumber(source);
    }
  });
  appendUpToUnique(newContents, newDisplayContents, "EMAIL", emails, Integer.MAX_VALUE, null);
  append(newContents, newDisplayContents, "URL", url);
  append(newContents, newDisplayContents, "NOTE", note);
  newContents.append("END:VCARD").append(TERMINATOR);
  return new String[] { newContents.toString(), newDisplayContents.toString() };
}
 
Example #10
Source File: SMSResultHandler.java    From barcodescanner-lib-aar with MIT License 5 votes vote down vote up
@Override
public CharSequence getDisplayContents() {
  SMSParsedResult smsResult = (SMSParsedResult) getResult();
  String[] rawNumbers = smsResult.getNumbers();
  String[] formattedNumbers = new String[rawNumbers.length];
  for (int i = 0; i < rawNumbers.length; i++) {
    formattedNumbers[i] = PhoneNumberUtils.formatNumber(rawNumbers[i]);
  }
  StringBuilder contents = new StringBuilder(50);
  ParsedResult.maybeAppend(formattedNumbers, contents);
  ParsedResult.maybeAppend(smsResult.getSubject(), contents);
  ParsedResult.maybeAppend(smsResult.getBody(), contents);
  return contents.toString();
}
 
Example #11
Source File: VCardContactEncoder.java    From BarcodeEye with Apache License 2.0 5 votes vote down vote up
@Override
public String[] encode(Iterable<String> names,
                       String organization,
                       Iterable<String> addresses,
                       Iterable<String> phones,
                       Iterable<String> emails,
                       Iterable<String> urls,
                       String note) {
  StringBuilder newContents = new StringBuilder(100);
  newContents.append("BEGIN:VCARD").append(TERMINATOR);
  newContents.append("VERSION:3.0").append(TERMINATOR);
  StringBuilder newDisplayContents = new StringBuilder(100);
  appendUpToUnique(newContents, newDisplayContents, "N", names, 1, null);
  append(newContents, newDisplayContents, "ORG", organization);
  appendUpToUnique(newContents, newDisplayContents, "ADR", addresses, 1, null);
  appendUpToUnique(newContents, newDisplayContents, "TEL", phones, Integer.MAX_VALUE, new Formatter() {
    @Override
    public String format(String source) {
      return PhoneNumberUtils.formatNumber(source);
    }
  });
  appendUpToUnique(newContents, newDisplayContents, "EMAIL", emails, Integer.MAX_VALUE, null);
  appendUpToUnique(newContents, newDisplayContents, "URL", urls, Integer.MAX_VALUE, null);
  append(newContents, newDisplayContents, "NOTE", note);
  newContents.append("END:VCARD").append(TERMINATOR);
  return new String[] { newContents.toString(), newDisplayContents.toString() };
}
 
Example #12
Source File: SmsOperationData.java    From Easer with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings({"SimplifiableIfStatement", "RedundantIfStatement"})
@Override
public boolean isValid() {
    if (Utils.isBlank(destination))
        return false;
    if (!PhoneNumberUtils.isWellFormedSmsAddress(destination))
        return false;
    if (Utils.isBlank(content))
        return false;
    return true;
}
 
Example #13
Source File: SMSResultHandler.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
@Override
public CharSequence getDisplayContents() {
  SMSParsedResult smsResult = (SMSParsedResult) getResult();
  String[] rawNumbers = smsResult.getNumbers();
  String[] formattedNumbers = new String[rawNumbers.length];
  for (int i = 0; i < rawNumbers.length; i++) {
    formattedNumbers[i] = PhoneNumberUtils.formatNumber(rawNumbers[i]);
  }
  StringBuilder contents = new StringBuilder(50);
  ParsedResult.maybeAppend(formattedNumbers, contents);
  ParsedResult.maybeAppend(smsResult.getSubject(), contents);
  ParsedResult.maybeAppend(smsResult.getBody(), contents);
  return contents.toString();
}
 
Example #14
Source File: sendSMS.java    From ShellMS with GNU General Public License v3.0 5 votes vote down vote up
private String makeNumberValid(String contact)	{
	if (contact == null)	{
		return null;
	}
	String number = PhoneNumberUtils.normalizeNumber(contact);
	if (DEBUG)	{
		Log.e(TAG, "corrected number: " + number );
	}
	boolean valid = isNumberValid(number);
	if (valid)	{
		return number;
	}
	return null;
}
 
Example #15
Source File: sendSMS.java    From ShellMS with GNU General Public License v3.0 5 votes vote down vote up
private Boolean isNumberValid(String contact)	{
if (contact == null)	{
	return false;
}
boolean valid1 = PhoneNumberUtils.isGlobalPhoneNumber(contact);
boolean valid2 = PhoneNumberUtils.isWellFormedSmsAddress(contact);
      return (valid1) && (valid2);
  }
 
Example #16
Source File: VCardTelDisplayFormatter.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
@Override
public CharSequence format(CharSequence value, int index) {
  value = PhoneNumberUtils.formatNumber(value.toString());
  Map<String,Set<String>> metadata =
      metadataForIndex == null || metadataForIndex.size() <= index ? null : metadataForIndex.get(index);
  value = formatMetadata(value, metadata);
  return value;
}
 
Example #17
Source File: VCardTelDisplayFormatter.java    From weex with Apache License 2.0 5 votes vote down vote up
@Override
public CharSequence format(CharSequence value, int index) {
  value = PhoneNumberUtils.formatNumber(value.toString());
  Map<String,Set<String>> metadata =
      metadataForIndex == null || metadataForIndex.size() <= index ? null : metadataForIndex.get(index);
  value = formatMetadata(value, metadata);
  return value;
}
 
Example #18
Source File: SMSResultHandler.java    From weex with Apache License 2.0 5 votes vote down vote up
@Override
public CharSequence getDisplayContents() {
  SMSParsedResult smsResult = (SMSParsedResult) getResult();
  String[] rawNumbers = smsResult.getNumbers();
  String[] formattedNumbers = new String[rawNumbers.length];
  for (int i = 0; i < rawNumbers.length; i++) {
    formattedNumbers[i] = PhoneNumberUtils.formatNumber(rawNumbers[i]);
  }
  StringBuilder contents = new StringBuilder(50);
  ParsedResult.maybeAppend(formattedNumbers, contents);
  ParsedResult.maybeAppend(smsResult.getSubject(), contents);
  ParsedResult.maybeAppend(smsResult.getBody(), contents);
  return contents.toString();
}
 
Example #19
Source File: AutofillAddress.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Checks address completion status in the given profile.
 *
 * If the country code is not set or invalid, but all fields for the default locale's country
 * code are present, then the profile is deemed "complete." AutoflllAddress.toPaymentAddress()
 * will use the default locale to fill in a blank country code before sending the address to the
 * renderer.
 *
 * @param  profile The autofill profile containing the address information.
 * @return int     The completion status.
 */
@CompletionStatus
public static int checkAddressCompletionStatus(
        AutofillProfile profile, @CompletenessCheckType int checkType) {
    int invalidFieldsCount = 0;
    int completionStatus = COMPLETE;

    if (checkType != IGNORE_PHONE_COMPLETENESS_CHECK
            && !PhoneNumberUtils.isGlobalPhoneNumber(
                       PhoneNumberUtils.stripSeparators(profile.getPhoneNumber().toString()))) {
        completionStatus = INVALID_PHONE_NUMBER;
        invalidFieldsCount++;
    }

    List<Integer> requiredFields = AutofillProfileBridge.getRequiredAddressFields(
            AutofillAddress.getCountryCode(profile));
    for (int fieldId : requiredFields) {
        if (fieldId == AddressField.RECIPIENT || fieldId == AddressField.COUNTRY) continue;
        if (!TextUtils.isEmpty(getProfileField(profile, fieldId))) continue;
        completionStatus = INVALID_ADDRESS;
        invalidFieldsCount++;
        break;
    }

    if (TextUtils.isEmpty(profile.getFullName())) {
        completionStatus = INVALID_RECIPIENT;
        invalidFieldsCount++;
    }

    if (invalidFieldsCount > 1) {
        completionStatus = INVALID_MULTIPLE_FIELDS;
    }

    return completionStatus;
}
 
Example #20
Source File: CountryCodePicker.java    From CountryCodePickerProject with Apache License 2.0 5 votes vote down vote up
/**
     * updates hint
     */
    private void updateHint() {
        if (editText_registeredCarrierNumber != null && hintExampleNumberEnabled) {
            String formattedNumber = "";
            Phonenumber.PhoneNumber exampleNumber = getPhoneUtil().getExampleNumberForType(getSelectedCountryNameCode(), getSelectedHintNumberType());
            if (exampleNumber != null) {
                formattedNumber = exampleNumber.getNationalNumber() + "";
//                Log.d(TAG, "updateHint: " + formattedNumber);
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                    formattedNumber = PhoneNumberUtils.formatNumber(getSelectedCountryCodeWithPlus() + formattedNumber, getSelectedCountryNameCode());
                } else {
                    formattedNumber = PhoneNumberUtils.formatNumber(getSelectedCountryCodeWithPlus() + formattedNumber);
                }
                if (formattedNumber != null) {
                    formattedNumber = formattedNumber.substring(getSelectedCountryCodeWithPlus().length()).trim();
                }
//                Log.d(TAG, "updateHint: after format " + formattedNumber + " " + selectionMemoryTag);
            } else {
//                Log.w(TAG, "updateHint: No example number found for this country (" + getSelectedCountryNameCode() + ") or this type (" + hintExampleNumberType.name() + ").");
            }

            //fallback to original hint
            if (formattedNumber == null) {
                formattedNumber = originalHint;
            }

            editText_registeredCarrierNumber.setHint(formattedNumber);
        }
    }
 
Example #21
Source File: SMSResultHandler.java    From android-quick-response-code with Apache License 2.0 5 votes vote down vote up
@Override
public CharSequence getDisplayContents() {
    SMSParsedResult smsResult = (SMSParsedResult) getResult();
    StringBuilder contents = new StringBuilder(50);
    String[] rawNumbers = smsResult.getNumbers();
    String[] formattedNumbers = new String[rawNumbers.length];
    for (int i = 0; i < rawNumbers.length; i++) {
        formattedNumbers[i] = PhoneNumberUtils.formatNumber(rawNumbers[i]);
    }
    ParsedResult.maybeAppend(formattedNumbers, contents);
    ParsedResult.maybeAppend(smsResult.getSubject(), contents);
    ParsedResult.maybeAppend(smsResult.getBody(), contents);
    return contents.toString();
}
 
Example #22
Source File: SMSResultHandler.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
@Override
public CharSequence getDisplayContents() {
  SMSParsedResult smsResult = (SMSParsedResult) getResult();
  String[] rawNumbers = smsResult.getNumbers();
  String[] formattedNumbers = new String[rawNumbers.length];
  for (int i = 0; i < rawNumbers.length; i++) {
    formattedNumbers[i] = PhoneNumberUtils.formatNumber(rawNumbers[i]);
  }
  StringBuilder contents = new StringBuilder(50);
  ParsedResult.maybeAppend(formattedNumbers, contents);
  ParsedResult.maybeAppend(smsResult.getSubject(), contents);
  ParsedResult.maybeAppend(smsResult.getBody(), contents);
  return contents.toString();
}
 
Example #23
Source File: CustomPhoneNumberFormattingTextWatcher.java    From android-phone-number-with-flags with Apache License 2.0 5 votes vote down vote up
/**
 * Generate the formatted number by ignoring all non-dialable chars and stick the cursor to the
 * nearest dialable char to the left. For instance, if the number is  (650) 123-45678 and '4' is
 * removed then the cursor should be behind '3' instead of '-'.
 */
private String reformat(CharSequence s, int cursor) {
    // The index of char to the leftward of the cursor.
    int curIndex = cursor - 1;
    String formatted = null;
    mFormatter.clear();
    char lastNonSeparator = 0;
    boolean hasCursor = false;
    int len = s.length();
    for (int i = 0; i < len; i++) {
        char c = s.charAt(i);
        if (PhoneNumberUtils.isNonSeparator(c)) {
            if (lastNonSeparator != 0) {
                formatted = getFormattedNumber(lastNonSeparator, hasCursor);
                hasCursor = false;
            }
            lastNonSeparator = c;
        }
        if (i == curIndex) {
            hasCursor = true;
        }
    }
    if (lastNonSeparator != 0) {
        formatted = getFormattedNumber(lastNonSeparator, hasCursor);
    }
    return formatted;
}
 
Example #24
Source File: CanonicalAddressDatabase.java    From Silence with GNU General Public License v3.0 5 votes vote down vote up
@VisibleForTesting
static boolean isNumberAddress(@NonNull String number) {
  if (number.contains("@"))             return false;

  final String networkNumber = PhoneNumberUtils.extractNetworkPortion(number);

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

  return PhoneNumberUtils.isWellFormedSmsAddress(number);
}
 
Example #25
Source File: NfcMessageUtilityImpl.java    From android-nfc-lib with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 * Precondition :  At least number should not be null
 */
@Override
public NdefMessage createSms(@NotNull String number, String message) throws FormatException {
    number = number.startsWith("+") ? "+" + number.replaceAll("\\D", "") : number.replaceAll("\\D", "");
    if (!PhoneNumberUtils.isGlobalPhoneNumber((number))) {
        throw new FormatException();
    }
    String smsPattern = "sms:" + number + "?body=" + message;
    //String externalType = "nfclab.com:smsService";
    return createUriMessage(smsPattern, NfcPayloadHeader.CUSTOM_SCHEME);
}
 
Example #26
Source File: RecipientsFormatter.java    From Silence with GNU General Public License v3.0 5 votes vote down vote up
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.");
}
 
Example #27
Source File: RecipientsEditor.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
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);
}
 
Example #28
Source File: VCardTelDisplayFormatter.java    From ZXing-Orient with Apache License 2.0 5 votes vote down vote up
@Override
public CharSequence format(CharSequence value, int index) {
  value = PhoneNumberUtils.formatNumber(value.toString());
  Map<String,Set<String>> metadata =
      metadataForIndex == null || metadataForIndex.size() <= index ? null : metadataForIndex.get(index);
  value = formatMetadata(value, metadata);
  return value;
}
 
Example #29
Source File: SMSResultHandler.java    From ZXing-Standalone-library with Apache License 2.0 5 votes vote down vote up
@Override
public CharSequence getDisplayContents() {
  SMSParsedResult smsResult = (SMSParsedResult) getResult();
  String[] rawNumbers = smsResult.getNumbers();
  String[] formattedNumbers = new String[rawNumbers.length];
  for (int i = 0; i < rawNumbers.length; i++) {
    formattedNumbers[i] = PhoneNumberUtils.formatNumber(rawNumbers[i]);
  }
  StringBuilder contents = new StringBuilder(50);
  ParsedResult.maybeAppend(formattedNumbers, contents);
  ParsedResult.maybeAppend(smsResult.getSubject(), contents);
  ParsedResult.maybeAppend(smsResult.getBody(), contents);
  return contents.toString();
}
 
Example #30
Source File: InternationalPhoneTextWatcher.java    From CountryCodePickerProject with Apache License 2.0 5 votes vote down vote up
private boolean hasSeparator(final CharSequence s, final int start, final int count) {
    for (int i = start; i < start + count; i++) {
        char c = s.charAt(i);
        if (!PhoneNumberUtils.isNonSeparator(c)) {
            return true;
        }
    }
    return false;
}