From f744f53ed980ba901b458b070a1b5eb4526b69f3 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Mon, 19 Nov 2012 15:25:51 -0800 Subject: Allow vanity numbers via paste/DIAL intent https://googleplex-android-review.googlesource.com/#/c/253417/ Converts vanity numbers such as 1-800-FLOWERS to the numeric equivalents when the number string is populated via a DIAL intent or pasted from the clipboard. Does not remove valid formatting such as dashes, periods, spaces, etc. Bug: 8858358 Change-Id: I553c91628b8fd86ff38a8eeec7823ebdc96bfe6b --- src/com/android/dialer/dialpad/DialpadFragment.java | 4 +++- src/com/android/dialer/dialpad/UnicodeDialerKeyListener.java | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src/com/android') diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index 3693e6aa0..20148b705 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -395,7 +395,9 @@ public class DialpadFragment extends Fragment String data = uri.getSchemeSpecificPart(); // Remember it is filled via Intent. mDigitsFilledByIntent = true; - setFormattedDigits(data, null); + final String converted = PhoneNumberUtils.convertKeypadLettersToDigits( + PhoneNumberUtils.replaceUnicodeDigits(data)); + setFormattedDigits(converted, null); return true; } else { String type = intent.getType(); diff --git a/src/com/android/dialer/dialpad/UnicodeDialerKeyListener.java b/src/com/android/dialer/dialpad/UnicodeDialerKeyListener.java index c25c7a9dd..740b4566f 100644 --- a/src/com/android/dialer/dialpad/UnicodeDialerKeyListener.java +++ b/src/com/android/dialer/dialpad/UnicodeDialerKeyListener.java @@ -31,7 +31,8 @@ public class UnicodeDialerKeyListener extends DialerKeyListener { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { - CharSequence converted = PhoneNumberUtils.replaceUnicodeDigits(source.toString()); + final String converted = PhoneNumberUtils.convertKeypadLettersToDigits( + PhoneNumberUtils.replaceUnicodeDigits(source.toString())); // PhoneNumberUtils.replaceUnicodeDigits performs a character for character replacement, // so we can assume that start and end positions should remain unchanged. CharSequence result = super.filter(converted, start, end, dest, dstart, dend); -- cgit v1.2.3