mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-18 03:48:08 +00:00
Fix some issues
This commit is contained in:
parent
ad537c9807
commit
e6fa0a62b9
3 changed files with 16 additions and 7 deletions
|
|
@ -1041,7 +1041,7 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
|||
}
|
||||
}
|
||||
|
||||
private void prepareContactsInBackground() {
|
||||
private synchronized void prepareContactsInBackground() {
|
||||
if (contactCursor != null) {
|
||||
contactCursor.close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
|
|
@ -69,12 +70,14 @@ public final class LinphoneUtils {
|
|||
|
||||
public static boolean isSipAddress(String numberOrAddress) {
|
||||
Pattern p = Pattern.compile(sipAddressRegExp);
|
||||
return p.matcher(numberOrAddress).matches();
|
||||
Matcher m = p.matcher(numberOrAddress);
|
||||
return m != null && m.matches();
|
||||
}
|
||||
|
||||
public static boolean isStrictSipAddress(String numberOrAddress) {
|
||||
Pattern p = Pattern.compile(strictSipAddressRegExp);
|
||||
return p.matcher(numberOrAddress).matches();
|
||||
Matcher m = p.matcher(numberOrAddress);
|
||||
return m != null && m.matches();
|
||||
}
|
||||
|
||||
public static String getUsernameFromAddress(String address) {
|
||||
|
|
|
|||
|
|
@ -302,17 +302,23 @@ public class ApiFivePlus {
|
|||
Contact contact = getContact(cr, cursor, 0);
|
||||
if (contact != null && contact.getNumerosOrAddresses().contains(sipUri)) {
|
||||
address.setDisplayName(contact.getName());
|
||||
cursor.close();
|
||||
return contact.getPhotoUri();
|
||||
}
|
||||
|
||||
|
||||
cursor.close();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String refreshContactName(ContentResolver cr, String id) {
|
||||
Cursor c = getGeneralContactCursor(cr, Data.CONTACT_ID + " = '" + id + "'", false);
|
||||
if (c != null && c.moveToFirst()) {
|
||||
return getContactDisplayName(c);
|
||||
Cursor cursor = getGeneralContactCursor(cr, Data.CONTACT_ID + " = '" + id + "'", false);
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
String contactDisplayName = getContactDisplayName(cursor);
|
||||
cursor.close();
|
||||
return contactDisplayName;
|
||||
}
|
||||
|
||||
cursor.close();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue