mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-23 06:38:09 +00:00
Fix contact with linphone friend
This commit is contained in:
parent
b6722d7a65
commit
a5c39de505
5 changed files with 11 additions and 14 deletions
|
|
@ -188,6 +188,7 @@
|
|||
android:src="@drawable/quit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true" />
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneFriend;
|
||||
|
||||
|
|
@ -43,7 +42,7 @@ public class Contact implements Serializable {
|
|||
private transient Bitmap photo;
|
||||
private List<String> numbersOrAddresses;
|
||||
private boolean hasFriends;
|
||||
private LinphoneAddress address;
|
||||
private String address;
|
||||
|
||||
public Contact(String id, String name) {
|
||||
super();
|
||||
|
|
@ -55,10 +54,10 @@ public class Contact implements Serializable {
|
|||
this.address = null;
|
||||
}
|
||||
|
||||
public Contact(String id, LinphoneAddress address) {
|
||||
public Contact(String id, String address, String name) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = LinphoneUtils.getAddressDisplayName(address);
|
||||
this.name = name;
|
||||
this.photoUri = null;
|
||||
this.thumbnailUri = null;
|
||||
this.address = address;
|
||||
|
|
@ -100,7 +99,7 @@ public class Contact implements Serializable {
|
|||
return name;
|
||||
}
|
||||
|
||||
public LinphoneAddress getLinphoneAddress() {
|
||||
public String getLinphoneAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
|||
public void onClick(View v) {
|
||||
if (LinphoneActivity.isInstanciated()) {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Log.w("Dial");
|
||||
if (lc != null) {
|
||||
LinphoneProxyConfig lpc = lc.getDefaultProxyConfig();
|
||||
String to;
|
||||
|
|
@ -86,7 +85,6 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
|||
};
|
||||
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
Log.w("onCreateView");
|
||||
contact = (Contact) getArguments().getSerializable("Contact");
|
||||
|
||||
this.inflater = inflater;
|
||||
|
|
@ -133,17 +131,17 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
|||
View v = inflater.inflate(R.layout.contact_control_row, null);
|
||||
|
||||
TextView tv = (TextView) v.findViewById(R.id.numeroOrAddress);
|
||||
tv.setText(contact.getLinphoneAddress().asStringUriOnly());
|
||||
tv.setText(contact.getLinphoneAddress());
|
||||
|
||||
if (!displayChatAddressOnly) {
|
||||
v.findViewById(R.id.call).setOnClickListener(dialListener);
|
||||
v.findViewById(R.id.call).setTag(contact.getLinphoneAddress().asStringUriOnly());
|
||||
v.findViewById(R.id.call).setTag(contact.getLinphoneAddress());
|
||||
} else {
|
||||
v.findViewById(R.id.call).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
v.findViewById(R.id.chat).setOnClickListener(chatListener);
|
||||
v.findViewById(R.id.chat).setTag(contact.getLinphoneAddress().asStringUriOnly());
|
||||
v.findViewById(R.id.chat).setTag(contact.getLinphoneAddress());
|
||||
|
||||
if (getResources().getBoolean(R.bool.disable_chat)) {
|
||||
v.findViewById(R.id.chat).setVisibility(View.GONE);
|
||||
|
|
|
|||
|
|
@ -300,7 +300,6 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
|
||||
@Override
|
||||
public void onPause() {
|
||||
Log.w("onPause ");
|
||||
instance = null;
|
||||
if (searchCursor != null) {
|
||||
searchCursor.close();
|
||||
|
|
|
|||
|
|
@ -246,8 +246,8 @@ public class ContactsManager {
|
|||
public Cursor searchFriends(String search) {
|
||||
searchContactList = new ArrayList<Contact>();
|
||||
for (LinphoneFriend friend : LinphoneManager.getLcIfManagerNotDestroyedOrNull().getFriendList()) {
|
||||
if (friend.getAddress().getUserName().contains(search)) {
|
||||
searchContactList.add(new Contact(friend.getRefKey(), friend.getAddress()));
|
||||
if (LinphoneUtils.getAddressDisplayName(friend.getAddress()).toLowerCase().contains(search.toLowerCase()) || friend.getAddress().getUserName().toLowerCase().contains(search.toLowerCase())) {
|
||||
searchContactList.add(new Contact(friend.getRefKey(),friend.getAddress().asStringUriOnly(),LinphoneUtils.getAddressDisplayName(friend.getAddress())));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -597,7 +597,7 @@ public class ContactsManager {
|
|||
if(LinphoneActivity.instance().getResources().getBoolean(R.bool.use_linphone_friend)){
|
||||
contactList = new ArrayList<Contact>();
|
||||
for(LinphoneFriend friend : LinphoneManager.getLc().getFriendList()){
|
||||
Contact contact = new Contact(friend.getRefKey(),friend.getAddress());
|
||||
Contact contact = new Contact(friend.getRefKey(),friend.getAddress().asStringUriOnly(),LinphoneUtils.getAddressDisplayName(friend.getAddress()));
|
||||
contactList.add(contact);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue