Skip to content

Commit 77359e7

Browse files
committed
Fixing wrong Japanese phone formatter.
http://code.google.com/p/android/issues/detail?id=15383 Adding rules that Japanese number start with 050 and 060. Change-Id: Id324d7ecfb18b348230a3903b356647045700d80
1 parent 1de4a2c commit 77359e7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

telephony/java/android/telephony/JapanesePhoneNumberFormatter.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@
2424
*
2525
* 022-229-1234 0223-23-1234 022-301-9876 015-482-7849 0154-91-3478
2626
* 01547-5-4534 090-1234-1234 080-0123-6789
27+
* 050-0000-0000 060-0000-0000
2728
* 0800-000-9999 0570-000-000 0276-00-0000
2829
*
2930
* As you can see, there is no straight-forward rule here.
3031
* In order to handle this, a big array is prepared.
3132
*/
3233
/* package */ class JapanesePhoneNumberFormatter {
3334
private static short FORMAT_MAP[] = {
34-
-100, 10, 220, -15, 410, 530, -15, 670, 780, 1060,
35+
-100, 10, 220, -15, 410, 530, 1200, 670, 780, 1060,
3536
-100, -25, 20, 40, 70, 100, 150, 190, 200, 210,
3637
-36, -100, -100, -35, -35, -35, 30, -100, -100, -100,
3738
-35, -35, -35, -35, -35, -35, -35, -45, -35, -35,
@@ -84,7 +85,7 @@
8485
-35, -25, -25, -25, -25, -25, -25, -25, -25, -25,
8586
-25, -25, -25, -35, -35, -35, -25, -25, -25, 520,
8687
-100, -100, -45, -100, -45, -100, -45, -100, -45, -100,
87-
-25, -100, -25, 540, 580, 590, 600, 610, 630, 640,
88+
-26, -100, -25, 540, 580, 590, 600, 610, 630, 640,
8889
-25, -35, -35, -35, -25, -25, -35, -35, -35, 550,
8990
-35, -35, -25, -25, -25, -25, 560, 570, -25, -35,
9091
-35, -35, -35, -35, -25, -25, -25, -25, -25, -25,
@@ -150,7 +151,8 @@
150151
-35, 1170, -25, -35, 1180, -35, 1190, -35, -25, -25,
151152
-100, -100, -45, -45, -100, -100, -100, -100, -100, -100,
152153
-25, -35, -35, -35, -35, -35, -35, -25, -25, -35,
153-
-35, -35, -35, -35, -35, -35, -35, -35, -35, -45};
154+
-35, -35, -35, -35, -35, -35, -35, -35, -35, -45,
155+
-26, -15, -15, -15, -15, -15, -15, -15, -15, -15};
154156

155157
public static void format(Editable text) {
156158
// Here, "root" means the position of "'":

0 commit comments

Comments
 (0)