Improved chat rooms list UI
This commit is contained in:
parent
160ce5c2f2
commit
386ed3f368
16 changed files with 55 additions and 61 deletions
Binary file not shown.
Before Width: | Height: | Size: 840 B |
Binary file not shown.
Before Width: | Height: | Size: 801 B |
5
res/drawable/unread_message_count_bg.xml
Normal file
5
res/drawable/unread_message_count_bg.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
|
||||
<solid android:color="@color/colorA"/>
|
||||
<size android:width="20dp" android:height="20dp"/>
|
||||
</shape>
|
|
@ -250,10 +250,10 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/missed_chats"
|
||||
android:background="@drawable/history_chat_indicator"
|
||||
android:background="@drawable/unread_message_count_bg"
|
||||
style="@style/font18"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="15dp"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"/>
|
||||
|
|
|
@ -64,9 +64,9 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/unreadMessages"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:background="@drawable/chat_list_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/unread_message_count_bg"
|
||||
android:contentDescription="@string/content_description_unread_chat_message"
|
||||
style="@style/font18"
|
||||
android:gravity="center"
|
||||
|
|
|
@ -104,10 +104,10 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/missed_calls"
|
||||
android:background="@drawable/history_chat_indicator"
|
||||
android:background="@drawable/unread_message_count_bg"
|
||||
style="@style/font18"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="15dp"
|
||||
|
@ -190,10 +190,10 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/missed_chats"
|
||||
android:background="@drawable/history_chat_indicator"
|
||||
android:background="@drawable/unread_message_count_bg"
|
||||
style="@style/font18"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="15dp"
|
||||
|
|
|
@ -259,10 +259,10 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/missed_chats"
|
||||
android:background="@drawable/history_chat_indicator"
|
||||
android:background="@drawable/unread_message_count_bg"
|
||||
style="@style/font18"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="15dp"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"/>
|
||||
|
|
|
@ -61,9 +61,9 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/unreadMessages"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:background="@drawable/chat_list_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/unread_message_count_bg"
|
||||
android:contentDescription="@string/content_description_unread_chat_message"
|
||||
style="@style/font18"
|
||||
android:gravity="center"
|
||||
|
|
|
@ -125,10 +125,10 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/missed_calls"
|
||||
android:background="@drawable/history_chat_indicator"
|
||||
android:background="@drawable/unread_message_count_bg"
|
||||
style="@style/font18"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_marginRight="5dp"
|
||||
android:visibility="gone"
|
||||
|
@ -211,10 +211,10 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/missed_chats"
|
||||
android:background="@drawable/history_chat_indicator"
|
||||
android:background="@drawable/unread_message_count_bg"
|
||||
style="@style/font18"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_marginRight="5dp"
|
||||
android:visibility="gone"
|
||||
|
|
|
@ -62,9 +62,9 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/unreadMessages"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:background="@drawable/chat_list_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/unread_message_count_bg"
|
||||
android:contentDescription="@string/content_description_unread_chat_message"
|
||||
style="@style/font18"
|
||||
android:gravity="center"
|
||||
|
|
|
@ -126,10 +126,10 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/missed_calls"
|
||||
android:background="@drawable/history_chat_indicator"
|
||||
android:background="@drawable/unread_message_count_bg"
|
||||
style="@style/font18"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_margin="20dp"
|
||||
android:layout_alignParentTop="true"
|
||||
|
@ -211,10 +211,10 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/missed_chats"
|
||||
android:background="@drawable/history_chat_indicator"
|
||||
android:background="@drawable/unread_message_count_bg"
|
||||
style="@style/font18"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:gravity="center"
|
||||
android:layout_alignParentTop="true"
|
||||
|
|
|
@ -306,10 +306,10 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/missed_chats"
|
||||
android:background="@drawable/history_chat_indicator"
|
||||
android:background="@drawable/unread_message_count_bg"
|
||||
style="@style/font18"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="15dp"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"/>
|
||||
|
|
|
@ -195,6 +195,6 @@
|
|||
android:src="@drawable/security_alert_button"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@id/top"
|
||||
android:layout_marginRight="6dp"/>
|
||||
android:layout_marginRight="12dp"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -64,10 +64,10 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/unreadMessages"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/content_description_unread_chat_message"
|
||||
android:background="@drawable/chat_list_indicator"
|
||||
android:background="@drawable/unread_message_count_bg"
|
||||
style="@style/font18"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
|
@ -82,19 +82,12 @@
|
|||
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"/>
|
||||
|
||||
<ImageView
|
||||
|
|
|
@ -104,10 +104,10 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/missed_calls"
|
||||
android:background="@drawable/history_chat_indicator"
|
||||
android:background="@drawable/unread_message_count_bg"
|
||||
style="@style/font18"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="15dp"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"/>
|
||||
|
@ -187,10 +187,10 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/missed_chats"
|
||||
android:background="@drawable/history_chat_indicator"
|
||||
android:background="@drawable/unread_message_count_bg"
|
||||
style="@style/font18"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="15dp"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"/>
|
||||
|
|
|
@ -46,7 +46,6 @@ public class ChatRoomViewHolder extends RecyclerView.ViewHolder implements View.
|
|||
private Bitmap mDefaultBitmap;
|
||||
private Bitmap mDefaultGroupBitmap;
|
||||
|
||||
public TextView lastMessageSenderView;
|
||||
public TextView lastMessageView;
|
||||
public TextView date;
|
||||
public TextView displayName;
|
||||
|
@ -65,7 +64,6 @@ public class ChatRoomViewHolder extends RecyclerView.ViewHolder implements View.
|
|||
mDefaultGroupBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.chat_group_avatar);
|
||||
|
||||
mContext = context;
|
||||
lastMessageSenderView = itemView.findViewById(R.id.lastMessageSender);
|
||||
lastMessageView = itemView.findViewById(R.id.lastMessage);
|
||||
date = itemView.findViewById(R.id.date);
|
||||
displayName = itemView.findViewById(R.id.sipUri);
|
||||
|
@ -82,24 +80,22 @@ public class ChatRoomViewHolder extends RecyclerView.ViewHolder implements View.
|
|||
public void bindChatRoom(ChatRoom room) {
|
||||
mRoom = room;
|
||||
ChatMessage lastMessage = mRoom.getLastMessageInHistory();
|
||||
lastMessageView.setVisibility(View.GONE);
|
||||
lastMessageFileTransfer.setVisibility(View.GONE);
|
||||
|
||||
if (lastMessage != null) {
|
||||
String text = lastMessage.getTextContent();
|
||||
if (text != null && text.length() > 0) {
|
||||
lastMessageView.setVisibility(View.VISIBLE);
|
||||
lastMessageView.setText(text);
|
||||
lastMessageView.setText(getSender(mRoom) + text);
|
||||
}
|
||||
date.setText(LinphoneUtils.timestampToHumanDate(mContext, mRoom.getLastUpdateTime(), R.string.messages_list_date_format));
|
||||
for (Content c : lastMessage.getContents()) {
|
||||
if (c.isFile() || c.isFileTransfer()) {
|
||||
lastMessageView.setText(getSender(mRoom));
|
||||
lastMessageFileTransfer.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastMessageSenderView.setText(getSender(mRoom));
|
||||
displayName.setText(getContact(mRoom));
|
||||
unreadMessages.setText(String.valueOf(LinphoneManager.getInstance().getUnreadCountForChatRoom(mRoom)));
|
||||
getAvatar(mRoom);
|
||||
|
|
Loading…
Reference in a new issue