Added conversation subject + participants in group chat header
This commit is contained in:
parent
6b0fc156f4
commit
eca2a15389
2 changed files with 43 additions and 11 deletions
|
@ -21,15 +21,31 @@
|
||||||
android:layout_weight="0.2"
|
android:layout_weight="0.2"
|
||||||
android:padding="18dp"/>
|
android:padding="18dp"/>
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/contact_name"
|
android:orientation="vertical"
|
||||||
style="@style/font6"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="0.4"
|
android:layout_weight="0.4"
|
||||||
android:gravity="center"/>
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/subject"
|
||||||
|
style="@style/font6"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/participants"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textColor="@color/colorC"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/start_call"
|
android:id="@+id/start_call"
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
private ImageView mBackButton, mCallButton, mBackToCallButton, mGroupInfosButton, mEditButton;
|
private ImageView mBackButton, mCallButton, mBackToCallButton, mGroupInfosButton, mEditButton;
|
||||||
private ImageView mCancelEditButton, mSelectAllButton, mDeselectAllButton, mDeleteSelectionButton;
|
private ImageView mCancelEditButton, mSelectAllButton, mDeselectAllButton, mDeleteSelectionButton;
|
||||||
private ImageView mAttachImageButton, mSendMessageButton;
|
private ImageView mAttachImageButton, mSendMessageButton;
|
||||||
private TextView mRoomLabel, mRemoteComposing;
|
private TextView mRoomLabel, mParticipantsLabel, mRemoteComposing;
|
||||||
private EditText mMessageTextToSend;
|
private EditText mMessageTextToSend;
|
||||||
private LayoutInflater mInflater;
|
private LayoutInflater mInflater;
|
||||||
private ListView mChatEventsList;
|
private ListView mChatEventsList;
|
||||||
|
@ -174,7 +174,8 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mRoomLabel = view.findViewById(R.id.contact_name);
|
mRoomLabel = view.findViewById(R.id.subject);
|
||||||
|
mParticipantsLabel = view.findViewById(R.id.participants);
|
||||||
|
|
||||||
mAttachImageButton = view.findViewById(R.id.send_picture);
|
mAttachImageButton = view.findViewById(R.id.send_picture);
|
||||||
mAttachImageButton.setOnClickListener(new View.OnClickListener() {
|
mAttachImageButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -239,12 +240,24 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
private void getContactsForParticipants() {
|
private void getContactsForParticipants() {
|
||||||
mParticipants = new ArrayList<>();
|
mParticipants = new ArrayList<>();
|
||||||
if (mChatRoom.canHandleParticipants()) {
|
if (mChatRoom.canHandleParticipants()) {
|
||||||
|
int index = 0;
|
||||||
|
StringBuilder participantsLabel = new StringBuilder();
|
||||||
for (Participant p : mChatRoom.getParticipants()) {
|
for (Participant p : mChatRoom.getParticipants()) {
|
||||||
LinphoneContact c = ContactsManager.getInstance().findContactFromAddress(p.getAddress());
|
LinphoneContact c = ContactsManager.getInstance().findContactFromAddress(p.getAddress());
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
mParticipants.add(c);
|
mParticipants.add(c);
|
||||||
|
participantsLabel.append(c.getFullName());
|
||||||
|
} else {
|
||||||
|
String displayName = p.getAddress().getDisplayName();
|
||||||
|
if (displayName != null && !displayName.isEmpty()) {
|
||||||
|
participantsLabel.append(displayName);
|
||||||
|
} else {
|
||||||
|
participantsLabel.append(p.getAddress().getUsername());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
index++;
|
||||||
|
if (index != mChatRoom.getNbParticipants()) participantsLabel.append(";");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
LinphoneContact c = ContactsManager.getInstance().findContactFromAddress(mRemoteSipAddress);
|
LinphoneContact c = ContactsManager.getInstance().findContactFromAddress(mRemoteSipAddress);
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
|
@ -282,9 +295,12 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
mCallButton.setVisibility(View.GONE);
|
mCallButton.setVisibility(View.GONE);
|
||||||
mGroupInfosButton.setVisibility(View.VISIBLE);
|
mGroupInfosButton.setVisibility(View.VISIBLE);
|
||||||
mRoomLabel.setText(mChatRoom.getSubject());
|
mRoomLabel.setText(mChatRoom.getSubject());
|
||||||
|
mParticipantsLabel.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
mCallButton.setVisibility(View.VISIBLE);
|
mCallButton.setVisibility(View.VISIBLE);
|
||||||
mGroupInfosButton.setVisibility(View.GONE);
|
mGroupInfosButton.setVisibility(View.GONE);
|
||||||
|
mParticipantsLabel.setVisibility(View.GONE);
|
||||||
|
|
||||||
if (mParticipants.size() == 0) {
|
if (mParticipants.size() == 0) {
|
||||||
// Contact not found
|
// Contact not found
|
||||||
|
|
Loading…
Reference in a new issue