本文整理汇总了Java中com.hyphenate.chat.EMMessage.ChatType类的典型用法代码示例。如果您正苦于以下问题:Java ChatType类的具体用法?Java ChatType怎么用?Java ChatType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ChatType类属于com.hyphenate.chat.EMMessage包,在下文中一共展示了ChatType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onMessageReceived
import com.hyphenate.chat.EMMessage.ChatType; //导入依赖的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);
}
}
}
开发者ID:turoDog,项目名称:KTalk,代码行数:23,代码来源:EaseChatFragment.java
示例2: sendMessage
import com.hyphenate.chat.EMMessage.ChatType; //导入依赖的package包/类
protected void sendMessage(EMMessage message){
if (message == null) {
return;
}
if(chatFragmentHelper != null){
//set extension
chatFragmentHelper.onSetMessageAttributes(message);
}
if (chatType == EaseConstant.CHATTYPE_GROUP){
message.setChatType(ChatType.GroupChat);
}else if(chatType == EaseConstant.CHATTYPE_CHATROOM){
message.setChatType(ChatType.ChatRoom);
}
//send message
EMClient.getInstance().chatManager().sendMessage(message);
//refresh ui
if(isMessageListInited) {
messageList.refreshSelectLast();
}
}
开发者ID:turoDog,项目名称:KTalk,代码行数:21,代码来源:EaseChatFragment.java
示例3: onBubbleClick
import com.hyphenate.chat.EMMessage.ChatType; //导入依赖的package包/类
@Override
protected void onBubbleClick() {
Intent intent = new Intent(context, EaseShowBigImageActivity.class);
File file = new File(imgBody.getLocalUrl());
if (file.exists()) {
Uri uri = Uri.fromFile(file);
intent.putExtra("uri", uri);
} else {
// The local full size pic does not exist yet.
// ShowBigImage needs to download it from the server
// first
String msgId = message.getMsgId();
intent.putExtra("messageId", msgId);
intent.putExtra("localUrl", imgBody.getLocalUrl());
}
if (message != null && message.direct() == EMMessage.Direct.RECEIVE && !message.isAcked()
&& message.getChatType() == ChatType.Chat) {
try {
EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId());
} catch (Exception e) {
e.printStackTrace();
}
}
context.startActivity(intent);
}
开发者ID:turoDog,项目名称:KTalk,代码行数:26,代码来源:EaseChatRowImage.java
示例4: onBubbleClick
import com.hyphenate.chat.EMMessage.ChatType; //导入依赖的package包/类
@Override
protected void onBubbleClick() {
String filePath = fileMessageBody.getLocalUrl();
File file = new File(filePath);
if (file.exists()) {
// open files if it exist
FileUtils.openFile(file, (Activity) context);
} else {
// download the file
context.startActivity(new Intent(context, EaseShowNormalFileActivity.class).putExtra("msg", message));
}
if (message.direct() == EMMessage.Direct.RECEIVE && !message.isAcked() && message.getChatType() == ChatType.Chat) {
try {
EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId());
} catch (HyphenateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
开发者ID:turoDog,项目名称:KTalk,代码行数:22,代码来源:EaseChatRowFile.java
示例5: onBubbleClick
import com.hyphenate.chat.EMMessage.ChatType; //导入依赖的package包/类
@Override
protected void onBubbleClick() {
EMVideoMessageBody videoBody = (EMVideoMessageBody) message.getBody();
EMLog.d(TAG, "video view is on click");
Intent intent = new Intent(context, EaseShowVideoActivity.class);
intent.putExtra("msg", message);
if (message != null && message.direct() == EMMessage.Direct.RECEIVE && !message.isAcked()
&& message.getChatType() == ChatType.Chat) {
try {
EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId());
} catch (Exception e) {
e.printStackTrace();
}
}
activity.startActivity(intent);
}
开发者ID:turoDog,项目名称:KTalk,代码行数:17,代码来源:EaseChatRowVideo.java
示例6: onMessageReceived
import com.hyphenate.chat.EMMessage.ChatType; //导入依赖的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);
}
}
}
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:23,代码来源:EaseChatFragment.java
示例7: onMessageReceived
import com.hyphenate.chat.EMMessage.ChatType; //导入依赖的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);
}
}
}
开发者ID:Vicent9920,项目名称:FanChat,代码行数:22,代码来源:EaseChatFragment.java
示例8: sendMessage
import com.hyphenate.chat.EMMessage.ChatType; //导入依赖的package包/类
protected void sendMessage(EMMessage message) {
if (message == null) {
return;
}
if (chatFragmentHelper != null) {
//set extension
chatFragmentHelper.onSetMessageAttributes(message);
}
if (chatType == EaseConstant.CHATTYPE_GROUP) {
message.setChatType(ChatType.GroupChat);
} else if (chatType == EaseConstant.CHATTYPE_CHATROOM) {
message.setChatType(ChatType.ChatRoom);
}
//send message
EMClient.getInstance().chatManager().sendMessage(message);
//refresh ui
if (isMessageListInited) {
messageList.refreshSelectLast();
}
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:21,代码来源:EaseChatFragment.java
示例9: onRequestToJoinAccepted
import com.hyphenate.chat.EMMessage.ChatType; //导入依赖的package包/类
@Override
public void onRequestToJoinAccepted(String groupId, String groupName, String accepter) {
String st4 = appContext.getString(R.string.Agreed_to_your_group_chat_application);
// your application was accepted
EMMessage msg = EMMessage.createReceiveMessage(Type.TXT);
msg.setChatType(ChatType.GroupChat);
msg.setFrom(accepter);
msg.setTo(groupId);
msg.setMsgId(UUID.randomUUID().toString());
msg.addBody(new EMTextMessageBody(accepter + " " + st4));
msg.setStatus(Status.SUCCESS);
// save accept message
EMClient.getInstance().chatManager().saveMessage(msg);
// notify the accept message
getNotifier().vibrateAndPlayTone(msg);
broadcastManager.sendBroadcast(new Intent(Constant.ACTION_GROUP_CHANAGED));
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:20,代码来源:DemoHelper.java
示例10: onAutoAcceptInvitationFromGroup
import com.hyphenate.chat.EMMessage.ChatType; //导入依赖的package包/类
@Override
public void onAutoAcceptInvitationFromGroup(String groupId, String inviter, String inviteMessage) {
// got an invitation
String st3 = appContext.getString(R.string.Invite_you_to_join_a_group_chat);
EMMessage msg = EMMessage.createReceiveMessage(Type.TXT);
msg.setChatType(ChatType.GroupChat);
msg.setFrom(inviter);
msg.setTo(groupId);
msg.setMsgId(UUID.randomUUID().toString());
msg.addBody(new EMTextMessageBody(inviter + " " + st3));
msg.setStatus(EMMessage.Status.SUCCESS);
// save invitation as messages
EMClient.getInstance().chatManager().saveMessage(msg);
// notify invitation message
getNotifier().vibrateAndPlayTone(msg);
EMLog.d(TAG, "onAutoAcceptInvitationFromGroup groupId:" + groupId);
broadcastManager.sendBroadcast(new Intent(Constant.ACTION_GROUP_CHANAGED));
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:19,代码来源:DemoHelper.java
示例11: onMessageReceived
import com.hyphenate.chat.EMMessage.ChatType; //导入依赖的package包/类
@Override
public void onMessageReceived(List<EMMessage> messages) {
for (EMMessage message : messages) {
String username = null;
// 群组消息
if (message.getChatType() == ChatType.GroupChat || message.getChatType() == ChatType.ChatRoom) {
username = message.getTo();
} else {
// 单聊消息
username = message.getFrom();
}
// 如果是当前会话的消息,刷新聊天页面
if (username.equals(toChatUsername)) {
messageList.refreshSelectLast();
// 声音和震动提示有新消息
EaseUI.getInstance().getNotifier().viberateAndPlayTone(message);
} else {
// 如果消息不是和当前聊天ID的消息
EaseUI.getInstance().getNotifier().onNewMsg(message);
}
}
}
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:25,代码来源:EaseChatFragment.java
示例12: sendMessage
import com.hyphenate.chat.EMMessage.ChatType; //导入依赖的package包/类
protected void sendMessage(EMMessage message){
if(chatFragmentListener != null){
//设置扩展属性
chatFragmentListener.onSetMessageAttributes(message);
}
// 如果是群聊,设置chattype,默认是单聊
if (chatType == EaseConstant.CHATTYPE_GROUP){
message.setChatType(ChatType.GroupChat);
}else if(chatType == EaseConstant.CHATTYPE_CHATROOM){
message.setChatType(ChatType.ChatRoom);
}
//发送消息
EMClient.getInstance().chatManager().sendMessage(message);
//刷新ui
if(isMessageListInited) {
messageList.refreshSelectLast();
}
}
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:19,代码来源:EaseChatFragment.java
示例13: onBubbleClick
import com.hyphenate.chat.EMMessage.ChatType; //导入依赖的package包/类
@Override
protected void onBubbleClick() {
Intent intent = new Intent(context, EaseShowBigImageActivity.class);
File file = new File(imgBody.getLocalUrl());
if (file.exists()) {
Uri uri = Uri.fromFile(file);
intent.putExtra("uri", uri);
} else {
// The local full size pic does not exist yet.
// ShowBigImage needs to download it from the server
// first
intent.putExtra("secret", imgBody.getSecret());
intent.putExtra("remotepath", imgBody.getRemoteUrl());
intent.putExtra("localUrl", imgBody.getLocalUrl());
}
if (message != null && message.direct() == EMMessage.Direct.RECEIVE && !message.isAcked()
&& message.getChatType() == ChatType.Chat) {
try {
EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId());
} catch (Exception e) {
e.printStackTrace();
}
}
context.startActivity(intent);
}
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:26,代码来源:EaseChatRowImage.java
示例14: onBubbleClick
import com.hyphenate.chat.EMMessage.ChatType; //导入依赖的package包/类
@Override
protected void onBubbleClick() {
String filePath = fileMessageBody.getLocalUrl();
File file = new File(filePath);
if (file != null && file.exists()) {
// 文件存在,直接打开
FileUtils.openFile(file, (Activity) context);
} else {
// 下载
context.startActivity(new Intent(context, EaseShowNormalFileActivity.class).putExtra("msgbody", message.getBody()));
}
if (message.direct() == EMMessage.Direct.RECEIVE && !message.isAcked() && message.getChatType() == ChatType.Chat) {
try {
EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId());
} catch (HyphenateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:22,代码来源:EaseChatRowFile.java
示例15: onBubbleClick
import com.hyphenate.chat.EMMessage.ChatType; //导入依赖的package包/类
@Override
protected void onBubbleClick() {
EMVideoMessageBody videoBody = (EMVideoMessageBody) message.getBody();
EMLog.d(TAG, "video view is on click");
Intent intent = new Intent(context, EaseShowVideoActivity.class);
intent.putExtra("localpath", videoBody.getLocalUrl());
intent.putExtra("secret", videoBody.getSecret());
intent.putExtra("remotepath", videoBody.getRemoteUrl());
if (message != null && message.direct() == EMMessage.Direct.RECEIVE && !message.isAcked()
&& message.getChatType() == ChatType.Chat) {
try {
EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId());
} catch (Exception e) {
e.printStackTrace();
}
}
activity.startActivity(intent);
}
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:19,代码来源:EaseChatRowVideo.java
示例16: parseMessages
import com.hyphenate.chat.EMMessage.ChatType; //导入依赖的package包/类
/**
* parse the message, get and save group id if I was mentioned(@)
* @param messages
*/
public void parseMessages(List<EMMessage> messages) {
int size = atMeGroupList.size();
EMMessage[] msgs = messages.toArray(new EMMessage[]{});
for(EMMessage msg : msgs){
if(msg.getChatType() == ChatType.GroupChat){
String groupId = msg.getTo();
String usernameStr = msg.getStringAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG, null);
if(usernameStr != null){
String[] usernames = usernameStr.split(",");
for(String username : usernames){
if(EMClient.getInstance().getCurrentUser().equals(username)){
if(!atMeGroupList.contains(groupId)){
atMeGroupList.add(groupId);
break;
}
}
}
if(atMeGroupList.size() != size){
EasePreferenceManager.getInstance().setAtMeGroups(atMeGroupList);
}
}
}
}
}
开发者ID:HyphenateInc,项目名称:Hyphenate-EaseUI-Android,代码行数:29,代码来源:EaseAtMessageHelper.java
示例17: onMessageReceived
import com.hyphenate.chat.EMMessage.ChatType; //导入依赖的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)) {
messageList.refreshSelectLast();
EaseUI.getInstance().getNotifier().vibrateAndPlayTone(message);
} else {
EaseUI.getInstance().getNotifier().onNewMsg(message);
}
}
}
开发者ID:HyphenateInc,项目名称:Hyphenate-EaseUI-Android,代码行数:22,代码来源:EaseChatFragment.java
示例18: onBubbleClick
import com.hyphenate.chat.EMMessage.ChatType; //导入依赖的package包/类
@Override
protected void onBubbleClick() {
String filePath = fileMessageBody.getLocalUrl();
File file = new File(filePath);
if (file != null && file.exists()) {
// open files if it exist
FileUtils.openFile(file, (Activity) context);
} else {
// download the file
context.startActivity(new Intent(context, EaseShowNormalFileActivity.class).putExtra("msgbody", message.getBody()));
}
if (message.direct() == EMMessage.Direct.RECEIVE && !message.isAcked() && message.getChatType() == ChatType.Chat) {
try {
EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId());
} catch (HyphenateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
开发者ID:HyphenateInc,项目名称:Hyphenate-EaseUI-Android,代码行数:22,代码来源:EaseChatRowFile.java
示例19: onApplicationAccept
import com.hyphenate.chat.EMMessage.ChatType; //导入依赖的package包/类
@Override
public void onApplicationAccept(String groupId, String groupName, String accepter) {
String st4 = appContext.getString(R.string.Agreed_to_your_group_chat_application);
// your application was accepted
EMMessage msg = EMMessage.createReceiveMessage(Type.TXT);
msg.setChatType(ChatType.GroupChat);
msg.setFrom(accepter);
msg.setTo(groupId);
msg.setMsgId(UUID.randomUUID().toString());
msg.addBody(new EMTextMessageBody(accepter + " " +st4));
msg.setStatus(Status.SUCCESS);
// save accept message
EMClient.getInstance().chatManager().saveMessage(msg);
// notify the accept message
getNotifier().vibrateAndPlayTone(msg);
broadcastManager.sendBroadcast(new Intent(Constant.ACTION_GROUP_CHANAGED));
}
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:20,代码来源:DemoHelper.java
示例20: onAutoAcceptInvitationFromGroup
import com.hyphenate.chat.EMMessage.ChatType; //导入依赖的package包/类
@Override
public void onAutoAcceptInvitationFromGroup(String groupId, String inviter, String inviteMessage) {
// got an invitation
String st3 = appContext.getString(R.string.Invite_you_to_join_a_group_chat);
EMMessage msg = EMMessage.createReceiveMessage(Type.TXT);
msg.setChatType(ChatType.GroupChat);
msg.setFrom(inviter);
msg.setTo(groupId);
msg.setMsgId(UUID.randomUUID().toString());
msg.addBody(new EMTextMessageBody(inviter + " " +st3));
msg.setStatus(EMMessage.Status.SUCCESS);
// save invitation as messages
EMClient.getInstance().chatManager().saveMessage(msg);
// notify invitation message
getNotifier().vibrateAndPlayTone(msg);
EMLog.d(TAG, "onAutoAcceptInvitationFromGroup groupId:" + groupId);
broadcastManager.sendBroadcast(new Intent(Constant.ACTION_GROUP_CHANAGED));
}
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:19,代码来源:DemoHelper.java
注:本文中的com.hyphenate.chat.EMMessage.ChatType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论