summaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
authorDaisuke Miyakawa <dmiyakawa@google.com>2009-10-28 23:33:07 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2009-10-28 23:33:07 -0700
commit33728557540d9033ff396f7a2ddd4fb304fdedcd (patch)
tree57e5f2d5c209c159e316d23f2fcf02c236bf74d1 /telephony
parentaa06a0e086d57ad3a0d063dfb5ab2cfb7936e4b4 (diff)
parentd95a02c2a652ffe35dcc0336a3e35d91b1027d54 (diff)
downloadframeworks_base-33728557540d9033ff396f7a2ddd4fb304fdedcd.zip
frameworks_base-33728557540d9033ff396f7a2ddd4fb304fdedcd.tar.gz
frameworks_base-33728557540d9033ff396f7a2ddd4fb304fdedcd.tar.bz2
am d95a02c2: Fix test breakage in Zaku. Modification to PhoneNumberUtils included.
Merge commit 'd95a02c2a652ffe35dcc0336a3e35d91b1027d54' into eclair-mr2-plus-aosp * commit 'd95a02c2a652ffe35dcc0336a3e35d91b1027d54': Fix test breakage in Zaku. Modification to PhoneNumberUtils included.
Diffstat (limited to 'telephony')
-rw-r--r--telephony/java/android/telephony/PhoneNumberUtils.java26
1 files changed, 22 insertions, 4 deletions
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index 6b33f52..586f63f 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -1060,8 +1060,8 @@ public class PhoneNumberUtils
* Breaks the given number down and formats it according to the rules
* for the country the number is from.
*
- * @param source the phone number to format
- * @return a locally acceptable formatting of the input, or the raw input if
+ * @param source The phone number to format
+ * @return A locally acceptable formatting of the input, or the raw input if
* formatting rules aren't known for the number
*/
public static String formatNumber(String source) {
@@ -1071,10 +1071,27 @@ public class PhoneNumberUtils
}
/**
+ * Formats the given number with the given formatting type. Currently
+ * {@link #FORMAT_NANP} and {@link #FORMAT_JAPAN} are supported as a formating type.
+ *
+ * @param source the phone number to format
+ * @param defaultFormattingType The default formatting rules to apply if the number does
+ * not begin with +<country_code>
+ * @return The phone number formatted with the given formatting type.
+ *
+ * @hide TODO:Shuold be unhidden.
+ */
+ public static String formatNumber(String source, int defaultFormattingType) {
+ SpannableStringBuilder text = new SpannableStringBuilder(source);
+ formatNumber(text, defaultFormattingType);
+ return text.toString();
+ }
+
+ /**
* Returns the phone number formatting type for the given locale.
*
* @param locale The locale of interest, usually {@link Locale#getDefault()}
- * @return the formatting type for the given locale, or FORMAT_UNKNOWN if the formatting
+ * @return The formatting type for the given locale, or FORMAT_UNKNOWN if the formatting
* rules are not known for the given locale
*/
public static int getFormatTypeForLocale(Locale locale) {
@@ -1084,7 +1101,8 @@ public class PhoneNumberUtils
}
/**
- * Formats a phone number in-place. Currently only supports NANP formatting.
+ * Formats a phone number in-place. Currently {@link #FORMAT_JAPAN} and {@link #FORMAT_NANP}
+ * is supported as a second argument.
*
* @param text The number to be formatted, will be modified with the formatting
* @param defaultFormattingType The default formatting rules to apply if the number does