Merge branch 'dev_phonenumber' of git.linphone.org:linphone-android into dev_phonenumber
This commit is contained in:
commit
3baeba55da
4 changed files with 56 additions and 12 deletions
|
@ -17,14 +17,33 @@
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
android:background="@color/colorE"/>
|
android:background="@color/colorE"/>
|
||||||
|
|
||||||
<TextView
|
<RelativeLayout
|
||||||
android:id="@+id/address_label"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_height="wrap_content">
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
<TextView
|
||||||
android:textAllCaps="true"
|
android:id="@+id/address_label"
|
||||||
android:textColor="@color/colorE" />
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAllCaps="true"
|
||||||
|
android:textColor="@color/colorE" />
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/friendLinphone"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:scaleType="centerInside"
|
||||||
|
android:src="@drawable/linphone_user" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/numeroOrAddress"
|
android:id="@+id/numeroOrAddress"
|
||||||
|
|
|
@ -134,9 +134,18 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
||||||
tv.setText(displayednumberOrAddress);
|
tv.setText(displayednumberOrAddress);
|
||||||
tv.setSelected(true);
|
tv.setSelected(true);
|
||||||
|
|
||||||
|
String contactAddress = contact.getPresenceModelForUri(noa.getValue());
|
||||||
|
if(contactAddress != null) {
|
||||||
|
v.findViewById(R.id.friendLinphone).setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
if (!displayChatAddressOnly) {
|
if (!displayChatAddressOnly) {
|
||||||
v.findViewById(R.id.contact_call).setOnClickListener(dialListener);
|
v.findViewById(R.id.contact_call).setOnClickListener(dialListener);
|
||||||
v.findViewById(R.id.contact_call).setTag(displayednumberOrAddress);
|
if(contactAddress != null){
|
||||||
|
v.findViewById(R.id.contact_call).setTag(contact.getPresenceModelForUri(noa.getValue()));
|
||||||
|
} else {
|
||||||
|
v.findViewById(R.id.contact_call).setTag(displayednumberOrAddress);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
v.findViewById(R.id.contact_call).setVisibility(View.GONE);
|
v.findViewById(R.id.contact_call).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
@ -146,9 +155,18 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
||||||
if (lpc != null) {
|
if (lpc != null) {
|
||||||
String username = lpc.normalizePhoneNumber(LinphoneUtils.getUsernameFromAddress(noa.getValue()));
|
String username = lpc.normalizePhoneNumber(LinphoneUtils.getUsernameFromAddress(noa.getValue()));
|
||||||
String tag = LinphoneUtils.getFullAddressFromUsername(username);
|
String tag = LinphoneUtils.getFullAddressFromUsername(username);
|
||||||
v.findViewById(R.id.contact_chat).setTag(tag);
|
|
||||||
|
if(contactAddress != null){
|
||||||
|
v.findViewById(R.id.contact_chat).setTag(contact.getPresenceModelForUri(noa.getValue()));
|
||||||
|
} else {
|
||||||
|
v.findViewById(R.id.contact_chat).setTag(tag);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
v.findViewById(R.id.contact_chat).setTag(noa.getValue());
|
if(contactAddress != null){
|
||||||
|
v.findViewById(R.id.contact_chat).setTag(contact.getPresenceModelForUri(noa.getValue()));
|
||||||
|
} else {
|
||||||
|
v.findViewById(R.id.contact_chat).setTag(noa.getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getResources().getBoolean(R.bool.disable_chat)) {
|
if (getResources().getBoolean(R.bool.disable_chat)) {
|
||||||
|
|
|
@ -217,7 +217,7 @@ public class ContactsManager extends ContentObserver {
|
||||||
contacts = c;
|
contacts = c;
|
||||||
sipContacts = new ArrayList<LinphoneContact>();
|
sipContacts = new ArrayList<LinphoneContact>();
|
||||||
for (LinphoneContact contact : contacts) {
|
for (LinphoneContact contact : contacts) {
|
||||||
if (contact.hasAddress()) {
|
if (contact.hasAddress() || contact.isInLinphoneFriendList()) {
|
||||||
sipContacts.add(contact);
|
sipContacts.add(contact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -635,6 +635,13 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
||||||
return (friend != null && friend.getPresenceModel() != null && friend.getPresenceModel().getBasicStatus().equals(PresenceBasicStatus.Open));
|
return (friend != null && friend.getPresenceModel() != null && friend.getPresenceModel().getBasicStatus().equals(PresenceBasicStatus.Open));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPresenceModelForUri(String uri) {
|
||||||
|
if (friend != null && friend.getPresenceModelForUri(uri) != null){
|
||||||
|
return friend.getPresenceModelForUri(uri).getContact();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public void setFriend(LinphoneFriend f) {
|
public void setFriend(LinphoneFriend f) {
|
||||||
friend = f;
|
friend = f;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue