mirror of
https://github.com/DrKLO/Telegram.git
synced 2025-01-03 09:49:15 +01:00
Update ContactsController.java
Check if the number has a country code, if not, prepend to the number the country code of the android user based on Locale. TOTALLY UNTESTED, just a quick idea.
This commit is contained in:
parent
ff85d74b85
commit
c3e5f11cc9
1 changed files with 7 additions and 0 deletions
|
@ -185,12 +185,19 @@ public class ContactsController {
|
|||
HashMap<Integer, Contact> contactsMap = new HashMap<Integer, Contact>();
|
||||
try {
|
||||
ContentResolver cr = ApplicationLoader.applicationContext.getContentResolver();
|
||||
Locale locale = Locale.getDefault();
|
||||
String country = locale.getCountry();
|
||||
String ids = "";
|
||||
Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, projectioPhones, null, null, null);
|
||||
if (pCur != null) {
|
||||
if (pCur.getCount() > 0) {
|
||||
while (pCur.moveToNext()) {
|
||||
String number = pCur.getString(1);
|
||||
|
||||
if !(number.startsWith("+")) {
|
||||
number = country + number;
|
||||
}
|
||||
|
||||
if (number == null || number.length() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue