Added add to contact option in chat message context menu
This commit is contained in:
parent
386ed3f368
commit
c1ba03a138
4 changed files with 24 additions and 0 deletions
|
@ -11,4 +11,7 @@
|
||||||
<item android:id="@+id/delete_message"
|
<item android:id="@+id/delete_message"
|
||||||
android:title="@string/delete" />
|
android:title="@string/delete" />
|
||||||
|
|
||||||
|
<item android:id="@+id/add_to_contacts"
|
||||||
|
android:title="@string/add_to_contacts" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
|
@ -14,4 +14,7 @@
|
||||||
<item android:id="@+id/delete_message"
|
<item android:id="@+id/delete_message"
|
||||||
android:title="@string/delete" />
|
android:title="@string/delete" />
|
||||||
|
|
||||||
|
<item android:id="@+id/add_to_contacts"
|
||||||
|
android:title="@string/add_to_contacts" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
|
@ -223,6 +223,7 @@
|
||||||
<string name="imdn_info">Delivery status</string>
|
<string name="imdn_info">Delivery status</string>
|
||||||
<string name="chat_room_devices">%s\'s devices</string>
|
<string name="chat_room_devices">%s\'s devices</string>
|
||||||
<string name="group_chat_room_devices">Conversation\'s devices</string>
|
<string name="group_chat_room_devices">Conversation\'s devices</string>
|
||||||
|
<string name="add_to_contacts">Add to contacts</string>
|
||||||
|
|
||||||
<!-- Status Bar -->
|
<!-- Status Bar -->
|
||||||
<string name="status_connected">Registered</string>
|
<string name="status_connected">Registered</string>
|
||||||
|
|
|
@ -410,6 +410,14 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
// Do not show copy text option if message doesn't have any text
|
// Do not show copy text option if message doesn't have any text
|
||||||
menu.removeItem(R.id.copy_text);
|
menu.removeItem(R.id.copy_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!message.isOutgoing()) {
|
||||||
|
Address address = message.getFromAddress();
|
||||||
|
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address);
|
||||||
|
if (contact != null) {
|
||||||
|
menu.removeItem(R.id.add_to_contacts);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -446,6 +454,15 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
mEventsAdapter.removeItem(mContextMenuMessagePosition);
|
mEventsAdapter.removeItem(mContextMenuMessagePosition);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (item.getItemId() == R.id.add_to_contacts) {
|
||||||
|
Address address = message.getFromAddress();
|
||||||
|
String uri = address.asStringUriOnly();
|
||||||
|
if (address != null && address.getDisplayName() != null)
|
||||||
|
LinphoneActivity.instance().displayContactsForEdition(address.asStringUriOnly(), address.getDisplayName());
|
||||||
|
else
|
||||||
|
LinphoneActivity.instance().displayContactsForEdition(uri);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return super.onContextItemSelected(item);
|
return super.onContextItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue