mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-18 03:48:08 +00:00
Fix check of last message content
This commit is contained in:
parent
d674105dc1
commit
dcdda672d8
2 changed files with 14 additions and 1 deletions
|
|
@ -55,6 +55,7 @@ import org.linphone.core.Call;
|
|||
import org.linphone.core.Call.State;
|
||||
import org.linphone.core.ChatRoom;
|
||||
import org.linphone.core.ChatRoomSecurityLevel;
|
||||
import org.linphone.core.Content;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.Friend;
|
||||
|
|
@ -806,5 +807,15 @@ public final class LinphoneUtils {
|
|||
|
||||
return ChatRoomSecurityLevel.ClearText;
|
||||
}
|
||||
|
||||
public static boolean hasContentFileSharing(Content[] contents) {
|
||||
if (contents == null) return false;
|
||||
|
||||
for (int i = 0 ; i < contents.length ; i++) {
|
||||
if (contents[i].isFileTransfer()) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ import java.util.Comparator;
|
|||
import java.util.List;
|
||||
|
||||
import static android.text.format.DateUtils.isToday;
|
||||
import static org.linphone.LinphoneUtils.hasContentFileSharing;
|
||||
|
||||
public class ChatRoomsAdapter extends ListSelectionAdapter {
|
||||
|
||||
|
|
@ -174,7 +175,8 @@ public class ChatRoomsAdapter extends ListSelectionAdapter {
|
|||
holder.date.setText(LinphoneUtils.timestampToHumanDate(mContext, chatRoom.getLastUpdateTime(), ((LinphoneUtils.isToday(chatRoom.getLastUpdateTime())) ? R.string.today_date_format2 : R.string.messages_list_date_format), false));
|
||||
|
||||
if (lastMessage != null) {
|
||||
if (lastMessage.getFileTransferInformation() != null || lastMessage.getExternalBodyUrl() != null || lastMessage.getContents().length > 0) {
|
||||
boolean hasContent = hasContentFileSharing(lastMessage.getContents());
|
||||
if (lastMessage.getFileTransferInformation() != null || lastMessage.getExternalBodyUrl() != null || hasContent) {
|
||||
holder.lastMessageView.setBackgroundResource(R.drawable.chat_file_message);
|
||||
} else if (lastMessage.getTextContent() != null && lastMessage.getTextContent().length() > 0) {
|
||||
holder.lastMessageView.setBackgroundResource(0);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue