Added fix for local calling codes:

replace leading 0 with default calling code
This commit is contained in:
Tobias 2014-02-23 12:27:34 +01:00
parent ff85d74b85
commit dffcdbeade
2 changed files with 16 additions and 0 deletions

View file

@ -24,6 +24,8 @@
package org.telegram.PhoneFormat;
import android.util.Log;
import org.telegram.ui.ApplicationLoader;
import java.io.ByteArrayOutputStream;
@ -371,4 +373,16 @@ public class PhoneFormat {
callingCodeInfo(defaultCallingCode);
}
}
/**
* If phone number starts with local calling code 0,
* replace with defaultCallingCode
* @return number with default code
*/
public String fixLocalCallingCodes(String number) {
if(number.startsWith("0")) {
return defaultCallingCode() + number.substring(1);
}
return number;
}
}

View file

@ -18,6 +18,7 @@ import android.database.Cursor;
import android.net.Uri;
import android.provider.BaseColumns;
import android.provider.ContactsContract;
import android.util.Log;
import android.util.SparseArray;
import org.telegram.PhoneFormat.PhoneFormat;
@ -194,6 +195,7 @@ public class ContactsController {
if (number == null || number.length() == 0) {
continue;
}
number = PhoneFormat.Instance.fixLocalCallingCodes(number);
number = PhoneFormat.stripExceptNumbers(number);
if (number.length() == 0) {
continue;