本文整理汇总了Java中com.hyphenate.chat.EMMessage.getFrom方法的典型用法代码示例。如果您正苦于以下问题:Java EMMessage.getFrom方法的具体用法?Java EMMessage.getFrom怎么用?Java EMMessage.getFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hyphenate.chat.EMMessage
的用法示例。
在下文中一共展示了EMMessage.getFrom方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMessageReceived
import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
public void onMessageReceived(List<EMMessage> messages) {
for (EMMessage message : messages) {
String username = null;
// group message
if (message.getChatType() == ChatType.GroupChat || message.getChatType() == ChatType.ChatRoom) {
username = message.getTo();
} else {
// single chat message
username = message.getFrom();
}
// if the message is for current conversation
if (username.equals(toChatUsername) || message.getTo().equals(toChatUsername)) {
messageList.refreshSelectLast();
EaseUI.getInstance().getNotifier().vibrateAndPlayTone(message);
conversation.markMessageAsRead(message.getMsgId());
} else {
EaseUI.getInstance().getNotifier().onNewMsg(message);
}
}
}
示例2: onMessageReceived
import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
public void onMessageReceived(List<EMMessage> messages) {
for (EMMessage message : messages) {
String username = null;
// group message
if (message.getChatType() == ChatType.GroupChat || message.getChatType() == ChatType.ChatRoom) {
username = message.getTo();
} else {
// single chat message
username = message.getFrom();
}
// if the message is for current conversation
if (username.equals(toChatUsername) || message.getTo().equals(toChatUsername) || message.conversationId().equals(toChatUsername)) {
messageList.refreshSelectLast();
EaseUI.getInstance().getNotifier().vibrateAndPlayTone(message);
conversation.markMessageAsRead(message.getMsgId());
} else {
EaseUI.getInstance().getNotifier().onNewMsg(message);
}
}
}
示例3: onMessageReceived
import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
public void onMessageReceived(List<EMMessage> messages) {
for (EMMessage message : messages) {
String username = null;
// group message
if (message.getChatType() == EMMessage.ChatType.GroupChat || message.getChatType() == EMMessage.ChatType.ChatRoom) {
username = message.getTo();
} else {
// single chat message
username = message.getFrom();
}
// if the message is for current conversation
if (username.equals(toChatUsername) || message.getTo().equals(toChatUsername) || message.conversationId().equals(toChatUsername)) {
messageList.refreshSelectLast();
EaseUI.getInstance().getNotifier().vibrateAndPlayTone(message);
conversation.markMessageAsRead(message.getMsgId());
} else {
EaseUI.getInstance().getNotifier().onNewMsg(message);
}
}
}
示例4: onMessageReceived
import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
public void onMessageReceived(List<EMMessage> messages) {
for (EMMessage message : messages) {
String username = null;
// group message
if (message.getChatType() == ChatType.GroupChat || message.getChatType() == ChatType.ChatRoom) {
username = message.getTo();
} else {
// single chat message
username = message.getFrom();
}
// if the message is for current conversation
if (username.equals(toChatUsername) || message.getTo().equals(toChatUsername)) {
messageList.refreshSelectLast();
EaseUI.getInstance().getNotifier().vibrateAndPlayTone(message);
} else {
EaseUI.getInstance().getNotifier().onNewMsg(message);
}
}
}