summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSam Blitzstein <sblitz@google.com>2012-09-19 15:37:29 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-09-19 15:37:29 -0700
commit2250d794b02d9d8590f626b698513dec9800bd79 (patch)
treed4d1e49b89d265bcda530d9be9df51ae9fb0f30a /src
parent93edcd71ed6993d662518ce1d6065d43b1d39ec1 (diff)
parent2e9eaec7547043275df06f7993640ca81c8245d3 (diff)
downloadandroid_packages_apps_Calendar-2250d794b02d9d8590f626b698513dec9800bd79.tar.gz
android_packages_apps_Calendar-2250d794b02d9d8590f626b698513dec9800bd79.tar.bz2
android_packages_apps_Calendar-2250d794b02d9d8590f626b698513dec9800bd79.zip
am 2e9eaec7: Merge "Allow "tel:" as phone prefix; more white space leniency." into ics-ub-calendar-aqua
* commit '2e9eaec7547043275df06f7993640ca81c8245d3': Allow "tel:" as phone prefix; more white space leniency.
Diffstat (limited to 'src')
-rw-r--r--src/com/android/calendar/EventInfoFragment.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/com/android/calendar/EventInfoFragment.java b/src/com/android/calendar/EventInfoFragment.java
index 4d8a4370..fffb631f 100644
--- a/src/com/android/calendar/EventInfoFragment.java
+++ b/src/com/android/calendar/EventInfoFragment.java
@@ -1397,6 +1397,7 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
* 94043 # too short, ignore
* 123456789012 # too long, ignore
* +1 (650) 555-1212 # 11 digits, spaces
+ * (650) 555 5555 # Second space, only when first is present.
* (650) 555-1212, (650) 555-1213 # two numbers, return first
* 1-650-555-1212 # 11 digits with leading '1'
* *#650.555.1212#*! # 10 digits, include #*, ignore trailing '!'
@@ -1406,10 +1407,17 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
* between the initial '1' and/or after the area code.
*/
+ // Check for "tel:" URI prefix.
+ if (text.length() > startPos+4
+ && text.subSequence(startPos, startPos+4).toString().equalsIgnoreCase("tel:")) {
+ startPos += 4;
+ }
+
int endPos = text.length();
int curPos = startPos;
int foundDigits = 0;
char firstDigit = 'x';
+ boolean foundWhiteSpaceAfterAreaCode = false;
while (curPos <= endPos) {
char ch;
@@ -1429,8 +1437,13 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
return -1;
}
} else if (Character.isWhitespace(ch)) {
- if (!( (firstDigit == '1' && (foundDigits == 1 || foundDigits == 4)) ||
- (foundDigits == 3)) ) {
+ if ( (firstDigit == '1' && foundDigits == 4) ||
+ (foundDigits == 3)) {
+ foundWhiteSpaceAfterAreaCode = true;
+ } else if (firstDigit == '1' && foundDigits == 1) {
+ } else if (foundWhiteSpaceAfterAreaCode
+ && ( (firstDigit == '1' && (foundDigits == 7)) || (foundDigits == 6))) {
+ } else {
break;
}
} else if (NANP_ALLOWED_SYMBOLS.indexOf(ch) == -1) {