In contact details, display SIP addresses first + use all SIP addresses and phone numbers from LinphoneFriend if available
This commit is contained in:
parent
99a4738c52
commit
f2c7048a0b
6 changed files with 39 additions and 16 deletions
|
@ -41,7 +41,6 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="20dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
* @deprecated
|
||||
*/
|
||||
public class ChatMessage {
|
||||
private String message;
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.linphone;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
|
@ -64,6 +65,15 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
changesToCommit2 = new ArrayList<ContentProviderOperation>();
|
||||
hasSipAddress = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(LinphoneContact contact) {
|
||||
String fullName = getFullName();
|
||||
String contactFullName = contact.getFullName();
|
||||
String firstLetter = fullName == null || fullName.isEmpty() ? "" : fullName.substring(0, 1).toUpperCase(Locale.getDefault());
|
||||
String contactfirstLetter = contactFullName == null || contactFullName.isEmpty() ? "" : contactFullName.substring(0, 1).toUpperCase(Locale.getDefault());
|
||||
return firstLetter.compareTo(contactfirstLetter);
|
||||
}
|
||||
|
||||
public void setFullName(String name) {
|
||||
fullName = name;
|
||||
|
@ -496,8 +506,20 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
thumbnailUri = null;
|
||||
photoUri = null;
|
||||
|
||||
LinphoneAddress addr = friend.getAddress();
|
||||
if (addr != null) {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null && lc.isVCardSupported()) {
|
||||
for (LinphoneAddress addr : friend.getAddresses()) {
|
||||
if (addr != null) {
|
||||
addNumberOrAddress(new LinphoneNumberOrAddress(addr.asStringUriOnly(), true));
|
||||
}
|
||||
}
|
||||
for (String tel : friend.getPhoneNumbers()) {
|
||||
if (tel != null) {
|
||||
addNumberOrAddress(new LinphoneNumberOrAddress(tel, false));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LinphoneAddress addr = friend.getAddress();
|
||||
addNumberOrAddress(new LinphoneNumberOrAddress(addr.asStringUriOnly(), true));
|
||||
}
|
||||
}
|
||||
|
@ -525,15 +547,6 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
}
|
||||
return createLinphoneFriend();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(LinphoneContact contact) {
|
||||
String fullName = getFullName();
|
||||
String contactFullName = contact.getFullName();
|
||||
String firstLetter = fullName == null || fullName.isEmpty() ? "" : fullName.substring(0, 1).toUpperCase(Locale.getDefault());
|
||||
String contactfirstLetter = contactFullName == null || contactFullName.isEmpty() ? "" : contactFullName.substring(0, 1).toUpperCase(Locale.getDefault());
|
||||
return firstLetter.compareTo(contactfirstLetter);
|
||||
}
|
||||
|
||||
private Uri getContactThumbnailPictureUri() {
|
||||
Uri person = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, Long.parseLong(getAndroidId()));
|
||||
|
@ -610,7 +623,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
}
|
||||
c.close();
|
||||
}
|
||||
|
||||
Collections.sort(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
mLinphoneFactoryConfigFile = basePath + "/linphonerc";
|
||||
mLinphoneConfigFile = basePath + "/.linphonerc";
|
||||
mLinphoneRootCaFile = basePath + "/rootca.pem";
|
||||
mRingSoundFile = basePath + "/notes_of_the_optimistic.mkv";
|
||||
mRingSoundFile = basePath + "/ringtone.mkv";
|
||||
mRingbackSoundFile = basePath + "/ringback.wav";
|
||||
mPauseSoundFile = basePath + "/hold.mkv";
|
||||
mChatDatabaseFile = basePath + "/linphone-history.db";
|
||||
|
@ -1100,6 +1100,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
|
||||
private synchronized void startRinging() {
|
||||
if (!LinphonePreferences.instance().isDeviceRingtoneEnabled()) {
|
||||
// Enable speaker audio route, linphone library will do the ringing itself automatically
|
||||
routeAudioToSpeaker();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.linphone;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class LinphoneNumberOrAddress implements Serializable {
|
||||
public class LinphoneNumberOrAddress implements Serializable, Comparable<LinphoneNumberOrAddress> {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -40,6 +40,15 @@ public class LinphoneNumberOrAddress implements Serializable {
|
|||
this(v, isSip);
|
||||
oldValueForUpdatePurpose = old;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(LinphoneNumberOrAddress noa) {
|
||||
if (noa.isSIPAddress() == isSIPAddress()) {
|
||||
return noa.getValue().compareTo(getValue());
|
||||
} else {
|
||||
return isSIPAddress() ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSIPAddress() {
|
||||
return isSIPAddress;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 7bd469baa080f657cfe3fd015f58ae32f57dbafc
|
||||
Subproject commit 94396dacec147c3a223e92a1c8c1da3ff61b127d
|
Loading…
Reference in a new issue