diff --git a/res/layout/chat_devices.xml b/res/layout/chat_devices.xml
new file mode 100644
index 000000000..16ed4378f
--- /dev/null
+++ b/res/layout/chat_devices.xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a9a9d8682..f6ddbee3a 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -221,6 +221,8 @@
Do you really want to delete and leave the selected conversations?
:
Delivery status
+ %s\'s devices
+ Conversation\'s devices
Registered
diff --git a/src/android/org/linphone/activities/LinphoneActivity.java b/src/android/org/linphone/activities/LinphoneActivity.java
index 2578345ec..759f651cf 100644
--- a/src/android/org/linphone/activities/LinphoneActivity.java
+++ b/src/android/org/linphone/activities/LinphoneActivity.java
@@ -73,6 +73,7 @@ import org.linphone.call.CallIncomingActivity;
import org.linphone.call.CallOutgoingActivity;
import org.linphone.chat.ChatCreationFragment;
import org.linphone.chat.ChatListFragment;
+import org.linphone.chat.DevicesFragment;
import org.linphone.chat.GroupChatFragment;
import org.linphone.chat.GroupInfoFragment;
import org.linphone.chat.ImdnFragment;
@@ -429,6 +430,9 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
case MESSAGE_IMDN:
fragment = new ImdnFragment();
break;
+ case CONTACT_DEVICES:
+ fragment = new DevicesFragment();
+ break;
default:
break;
}
@@ -752,6 +756,12 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
changeCurrentFragment(FragmentsAvailable.INFO_GROUP_CHAT, extras);
}
+ public void goToContactDevicesInfos(String sipUri) {
+ Bundle extras = new Bundle();
+ extras.putSerializable("SipUri", sipUri);
+ changeCurrentFragment(FragmentsAvailable.CONTACT_DEVICES, extras);
+ }
+
public void goToChatMessageImdnInfos(String sipUri, String messageId) {
Bundle extras = new Bundle();
extras.putSerializable("SipUri", sipUri);
@@ -880,6 +890,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
case GROUP_CHAT:
case INFO_GROUP_CHAT:
case MESSAGE_IMDN:
+ case CONTACT_DEVICES:
case CHAT:
chat_selected.setVisibility(View.VISIBLE);
break;
diff --git a/src/android/org/linphone/chat/DevicesFragment.java b/src/android/org/linphone/chat/DevicesFragment.java
new file mode 100644
index 000000000..c5dd62719
--- /dev/null
+++ b/src/android/org/linphone/chat/DevicesFragment.java
@@ -0,0 +1,111 @@
+/*
+DevicesFragment.java
+Copyright (C) 2010-2018 Belledonne Communications, Grenoble, France
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+package org.linphone.chat;
+
+import android.app.Fragment;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import org.linphone.LinphoneManager;
+import org.linphone.LinphoneUtils;
+import org.linphone.R;
+import org.linphone.activities.LinphoneActivity;
+import org.linphone.contacts.ContactsManager;
+import org.linphone.contacts.LinphoneContact;
+import org.linphone.core.Address;
+import org.linphone.core.ChatRoom;
+import org.linphone.core.ChatRoomCapabilities;
+import org.linphone.core.Core;
+
+public class DevicesFragment extends Fragment {
+ private LayoutInflater mInflater;
+ private ImageView mBackButton;
+ private TextView mTitle;
+
+ private String mRoomUri;
+ private Address mRoomAddr;
+ private ChatRoom mRoom;
+
+ @Nullable
+ @Override
+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ if (getArguments() != null) {
+ mRoomUri = getArguments().getString("SipUri");
+ mRoomAddr = LinphoneManager.getLc().createAddress(mRoomUri);
+ }
+
+ mInflater = inflater;
+ View view = mInflater.inflate(R.layout.chat_devices, container, false);
+
+ initChatRoom();
+
+ mTitle = view.findViewById(R.id.title);
+ initHeader();
+
+ mBackButton = view.findViewById(R.id.back);
+ mBackButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if (LinphoneActivity.instance().isTablet()) {
+ LinphoneActivity.instance().goToChat(mRoomUri, null);
+ } else {
+ LinphoneActivity.instance().onBackPressed();
+ }
+ }
+ });
+
+ return view;
+ }
+
+ private void initChatRoom() {
+ Core core = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
+ Address proxyConfigContact = core.getDefaultProxyConfig().getContact();
+ if (proxyConfigContact != null) {
+ mRoom = core.findOneToOneChatRoom(proxyConfigContact, mRoomAddr);
+ }
+ if (mRoom == null) {
+ mRoom = core.getChatRoomFromUri(mRoomAddr.asStringUriOnly());
+ }
+ }
+
+ private void initHeader() {
+ if (mRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt())) {
+ Address remoteParticipantAddr = mRoomAddr;
+ if (mRoom.getParticipants().length > 0) {
+ remoteParticipantAddr = mRoom.getParticipants()[0].getAddress();
+ }
+ LinphoneContact c = ContactsManager.getInstance().findContactFromAddress(remoteParticipantAddr);
+ String displayName;
+ if (c != null) {
+ displayName = c.getFullName();
+ } else {
+ displayName = LinphoneUtils.getAddressDisplayName(remoteParticipantAddr);
+ }
+ mTitle.setText(getString(R.string.chat_room_devices).replace("%s", displayName));
+ }
+ }
+}
diff --git a/src/android/org/linphone/chat/GroupChatFragment.java b/src/android/org/linphone/chat/GroupChatFragment.java
index a2195de13..a483f012e 100644
--- a/src/android/org/linphone/chat/GroupChatFragment.java
+++ b/src/android/org/linphone/chat/GroupChatFragment.java
@@ -112,6 +112,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
private int mContextMenuMessagePosition;
private ChatScrollListener mChatScrollListener;
private LinearLayout mTopBar;
+ private ImageView mChatRoomSecurityLevel;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@@ -130,6 +131,14 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
mTopBar = view.findViewById(R.id.top_bar);
+ mChatRoomSecurityLevel = view.findViewById(R.id.room_security_level);
+ mChatRoomSecurityLevel.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ LinphoneActivity.instance().goToContactDevicesInfos(getRemoteSipUri());
+ }
+ });
+
mBackButton = view.findViewById(R.id.back);
mBackButton.setOnClickListener(new View.OnClickListener() {
@Override
diff --git a/src/android/org/linphone/fragments/FragmentsAvailable.java b/src/android/org/linphone/fragments/FragmentsAvailable.java
index 6dfabfd74..cb2e2b55f 100644
--- a/src/android/org/linphone/fragments/FragmentsAvailable.java
+++ b/src/android/org/linphone/fragments/FragmentsAvailable.java
@@ -36,7 +36,8 @@ public enum FragmentsAvailable {
CREATE_CHAT,
INFO_GROUP_CHAT,
GROUP_CHAT,
- MESSAGE_IMDN;
+ MESSAGE_IMDN,
+ CONTACT_DEVICES;
public boolean shouldAddItselfToTheRightOf(FragmentsAvailable fragment) {
switch (this) {
@@ -58,6 +59,9 @@ public enum FragmentsAvailable {
case MESSAGE_IMDN:
return fragment == GROUP_CHAT || fragment == MESSAGE_IMDN;
+ case CONTACT_DEVICES:
+ return fragment == GROUP_CHAT || fragment == CONTACT_DEVICES;
+
default:
return false;
}