Display last message sender in chat rooms list
This commit is contained in:
parent
9758a6f684
commit
5910a468e4
6 changed files with 104 additions and 36 deletions
|
@ -97,14 +97,28 @@
|
|||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lastMessage"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:layout_below="@id/sipUri"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/font11"/>
|
||||
<LinearLayout
|
||||
android:id="@id/lastMessageLayout"
|
||||
android:layout_below="@id/sipUri"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lastMessageSender"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/font11"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lastMessage"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/font11"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
@ -93,15 +93,29 @@
|
|||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lastMessage"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:layout_below="@id/sipUri"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="30dp"
|
||||
style="@style/font11"/>
|
||||
<LinearLayout
|
||||
android:id="@id/lastMessageLayout"
|
||||
android:layout_below="@id/sipUri"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lastMessageSender"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/font11"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lastMessage"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="30dp"
|
||||
style="@style/font11"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
@ -94,15 +94,29 @@
|
|||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lastMessage"
|
||||
android:maxLines="3"
|
||||
android:ellipsize="end"
|
||||
android:layout_below="@id/sipUri"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="30dp"
|
||||
style="@style/font11"/>
|
||||
<LinearLayout
|
||||
android:id="@id/lastMessageLayout"
|
||||
android:layout_below="@id/sipUri"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lastMessageSender"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/font11"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lastMessage"
|
||||
android:maxLines="3"
|
||||
android:ellipsize="end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="30dp"
|
||||
style="@style/font11"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
@ -90,19 +90,33 @@
|
|||
style="@style/font18"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:layout_above="@+id/lastMessage"
|
||||
android:layout_above="@+id/lastMessageLayout"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lastMessage"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:layout_below="@id/sipUri"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="30dp"
|
||||
style="@style/font11"/>
|
||||
<LinearLayout
|
||||
android:id="@id/lastMessageLayout"
|
||||
android:layout_below="@id/sipUri"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lastMessageSender"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/font11"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lastMessage"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="30dp"
|
||||
style="@style/font11"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
@ -176,6 +176,7 @@ Vos amis pourront vous joindre plus facilement si vous associez votre compte à
|
|||
<string name="processing_image">Traitement de l\'image, cela peut prendre quelques secondes selon sa taille</string>
|
||||
<string name="displayed">Lu</string>
|
||||
<string name="delivered">Reçu</string>
|
||||
<string name="sent">Envoyé</string>
|
||||
<string name="resend">Renvoyer</string>
|
||||
<!--Status Bar-->
|
||||
<string name="status_connected">Enregistré</string>
|
||||
|
|
|
@ -52,6 +52,7 @@ import java.util.List;
|
|||
public class ChatRoomsAdapter extends ListSelectionAdapter {
|
||||
|
||||
private class ChatRoomViewHolder {
|
||||
public TextView lastMessageSenderView;
|
||||
public TextView lastMessageView;
|
||||
public TextView date;
|
||||
public TextView displayName;
|
||||
|
@ -60,6 +61,7 @@ public class ChatRoomsAdapter extends ListSelectionAdapter {
|
|||
public ImageView contactPicture;
|
||||
|
||||
public ChatRoomViewHolder(View view) {
|
||||
lastMessageSenderView = view.findViewById(R.id.lastMessageSender);
|
||||
lastMessageView = view.findViewById(R.id.lastMessage);
|
||||
date = view.findViewById(R.id.date);
|
||||
displayName = view.findViewById(R.id.sipUri);
|
||||
|
@ -141,6 +143,7 @@ public class ChatRoomsAdapter extends ListSelectionAdapter {
|
|||
int unreadMessagesCount = chatRoom.getUnreadMessagesCount();
|
||||
ChatMessage lastMessage = chatRoom.getLastMessageInHistory();
|
||||
holder.lastMessageView.setText("");
|
||||
holder.lastMessageSenderView.setText("");
|
||||
holder.date.setText(LinphoneUtils.timestampToHumanDate(mContext, chatRoom.getLastUpdateTime(), R.string.messages_list_date_format));
|
||||
|
||||
if (lastMessage != null) {
|
||||
|
@ -150,6 +153,14 @@ public class ChatRoomsAdapter extends ListSelectionAdapter {
|
|||
holder.lastMessageView.setBackgroundResource(0);
|
||||
holder.lastMessageView.setText(lastMessage.getTextContent());
|
||||
}
|
||||
|
||||
Address lastMessageSenderAddress = lastMessage.getFromAddress();
|
||||
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(lastMessageSenderAddress);
|
||||
if (contact != null) {
|
||||
holder.lastMessageSenderView.setText(contact.getFullName() + ": ");
|
||||
} else {
|
||||
holder.lastMessageSenderView.setText(LinphoneUtils.getAddressDisplayName(lastMessageSenderAddress) + ": ");
|
||||
}
|
||||
}
|
||||
|
||||
holder.displayName.setSelected(true); // For animation
|
||||
|
|
Loading…
Reference in a new issue