本文整理汇总了Java中com.hyphenate.chat.EMTextMessageBody类的典型用法代码示例。如果您正苦于以下问题:Java EMTextMessageBody类的具体用法?Java EMTextMessageBody怎么用?Java EMTextMessageBody使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EMTextMessageBody类属于com.hyphenate.chat包,在下文中一共展示了EMTextMessageBody类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: showNotification
import com.hyphenate.chat.EMTextMessageBody; //导入依赖的package包/类
private void showNotification(EMMessage emMessage) {
String contentText = "";
if (emMessage.getBody() instanceof EMTextMessageBody) {
contentText = ((EMTextMessageBody) emMessage.getBody()).getMessage();
}
Intent chat = new Intent(this, ChatActivity.class);
chat.putExtra(Constant.Extra.USER_NAME, emMessage.getUserName());
PendingIntent pendingIntent = PendingIntent.getActivity(this, 1, chat, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Notification notification = new Notification.Builder(this)
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.avatar1))
.setSmallIcon(R.mipmap.ic_contact_selected_2)
.setContentTitle(getString(R.string.receive_new_message))
.setContentText(contentText)
.setPriority(Notification.PRIORITY_MAX)
.setContentIntent(pendingIntent)
.setAutoCancel(true)
.build();
notificationManager.notify(1, notification);
}
开发者ID:Vicent9920,项目名称:FanChat,代码行数:23,代码来源:QQDemoApplication.java
示例2: onBubbleClick
import com.hyphenate.chat.EMTextMessageBody; //导入依赖的package包/类
@Override
protected void onBubbleClick() {
// TODO Auto-generated method stub
if (null != mBack) {
if (!StringUtils.isNotEmpty(message.getStringAttribute("groupRedPacket", null))) {
if (message.direct() == EMMessage.Direct.SEND) {
return;
}
}
// mBack.back(message.getIntAttribute("redPacketID",0),false,message);
mBack.back(message.getIntAttribute("redPacketID", 0), true, message.getStringAttribute("transfer", ""), ((EMTextMessageBody) message.getBody()).getMessage(),
message.getStringAttribute("name", ""), message.getFrom()
);
}
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:18,代码来源:EaseChatRowRedPacket.java
示例3: onRequestToJoinAccepted
import com.hyphenate.chat.EMTextMessageBody; //导入依赖的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
示例4: onAutoAcceptInvitationFromGroup
import com.hyphenate.chat.EMTextMessageBody; //导入依赖的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
示例5: onApplicationAccept
import com.hyphenate.chat.EMTextMessageBody; //导入依赖的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
示例6: onAutoAcceptInvitationFromGroup
import com.hyphenate.chat.EMTextMessageBody; //导入依赖的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
示例7: getView
import com.hyphenate.chat.EMTextMessageBody; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.em_row_search_message, parent, false);
}
ViewHolder holder = (ViewHolder) convertView.getTag();
if (holder == null) {
holder = new ViewHolder();
holder.name = (TextView) convertView.findViewById(R.id.name);
holder.message = (TextView) convertView.findViewById(R.id.message);
holder.time = (TextView) convertView.findViewById(R.id.time);
holder.avatar = (ImageView) convertView.findViewById(R.id.avatar);
convertView.setTag(holder);
}
EMMessage message = getItem(position);
EaseUserUtils.setUserNick(message.getFrom(), holder.name);
EaseUserUtils.setUserAvatar(getContext(), message.getFrom(), holder.avatar);
holder.time.setText(DateUtils.getTimestampString(new Date(message.getMsgTime())));
holder.message.setText(((EMTextMessageBody)message.getBody()).getMessage());
return convertView;
}
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:25,代码来源:GroupSearchMessageActivity.java
示例8: forwardMessage
import com.hyphenate.chat.EMTextMessageBody; //导入依赖的package包/类
/**
* forward message
*
* @param forward_msg_id
*/
protected void forwardMessage(String forward_msg_id) {
final EMMessage forward_msg = EMClient.getInstance().chatManager().getMessage(forward_msg_id);
EMMessage.Type type = forward_msg.getType();
switch (type) {
case TXT:
if(forward_msg.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_BIG_EXPRESSION, false)){
sendBigExpressionMessage(((EMTextMessageBody) forward_msg.getBody()).getMessage(),
forward_msg.getStringAttribute(EaseConstant.MESSAGE_ATTR_EXPRESSION_ID, null));
}else{
// get the content and send it
String content = ((EMTextMessageBody) forward_msg.getBody()).getMessage();
sendTextMessage(content);
}
break;
case IMAGE:
// send image
String filePath = ((EMImageMessageBody) forward_msg.getBody()).getLocalUrl();
if (filePath != null) {
File file = new File(filePath);
if (!file.exists()) {
// send thumb nail if original image does not exist
filePath = ((EMImageMessageBody) forward_msg.getBody()).thumbnailLocalPath();
}
sendImageMessage(filePath);
}
break;
default:
break;
}
if(forward_msg.getChatType() == EMMessage.ChatType.ChatRoom){
EMClient.getInstance().chatroomManager().leaveChatRoom(forward_msg.getTo());
}
}
开发者ID:turoDog,项目名称:KTalk,代码行数:40,代码来源:EaseChatFragment.java
示例9: onSetUpView
import com.hyphenate.chat.EMTextMessageBody; //导入依赖的package包/类
@Override
public void onSetUpView() {
EMTextMessageBody txtBody = (EMTextMessageBody) message.getBody();
Spannable span = EaseSmileUtils.getSmiledText(context, txtBody.getMessage());
// 设置内容
contentView.setText(span, BufferType.SPANNABLE);
handleTextMessage();
}
开发者ID:turoDog,项目名称:KTalk,代码行数:10,代码来源:EaseChatRowText.java
示例10: forwardMessage
import com.hyphenate.chat.EMTextMessageBody; //导入依赖的package包/类
/**
* forward message
*
* @param forward_msg_id
*/
protected void forwardMessage(String forward_msg_id) {
final EMMessage forward_msg = EMClient.getInstance().chatManager().getMessage(forward_msg_id);
EMMessage.Type type = forward_msg.getType();
switch (type) {
case TXT:
if(forward_msg.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_BIG_EXPRESSION, false)){
sendBigExpressionMessage(((EMTextMessageBody) forward_msg.getBody()).getMessage(),
forward_msg.getStringAttribute(EaseConstant.MESSAGE_ATTR_EXPRESSION_ID, null));
}else{
// get the content and send it
String content = ((EMTextMessageBody) forward_msg.getBody()).getMessage();
sendTextMessage(content);
}
break;
case IMAGE:
// send image
String filePath = ((EMImageMessageBody) forward_msg.getBody()).getLocalUrl();
if (filePath != null) {
File file = new File(filePath);
if (!file.exists()) {
// send thumb nail if original image does not exist
filePath = ((EMImageMessageBody) forward_msg.getBody()).thumbnailLocalPath();
}
sendImageMessage(filePath);
}
break;
default:
break;
}
if(forward_msg.getChatType() == ChatType.ChatRoom){
EMClient.getInstance().chatroomManager().leaveChatRoom(forward_msg.getTo());
}
}
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:40,代码来源:EaseChatFragment.java
示例11: forwardMessage
import com.hyphenate.chat.EMTextMessageBody; //导入依赖的package包/类
/**
* forward message
*
* @param forward_msg_id
*/
protected void forwardMessage(String forward_msg_id) {
final EMMessage forward_msg = EMClient.getInstance().chatManager().getMessage(forward_msg_id);
EMMessage.Type type = forward_msg.getType();
switch (type) {
case TXT:
if(forward_msg.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_BIG_EXPRESSION, false)){
sendBigExpressionMessage(((EMTextMessageBody) forward_msg.getBody()).getMessage(),
forward_msg.getStringAttribute(EaseConstant.MESSAGE_ATTR_EXPRESSION_ID, null));
}else{
// get the content and send it
String content = ((EMTextMessageBody) forward_msg.getBody()).getMessage();
sendTextMessage(content);
}
break;
case IMAGE:
// send image
String filePath = ((EMImageMessageBody) forward_msg.getBody()).getLocalUrl();
if (filePath != null) {
File file = new File(filePath);
if (!file.exists()) {
// send thumb nail if original image does not exist
filePath = ((EMImageMessageBody) forward_msg.getBody()).thumbnailLocalPath();
}
sendImageMessage(filePath);
}
break;
default:
break;
}
if(forward_msg.getChatType() == EMMessage.ChatType.ChatRoom){
EMClient.getInstance().chatroomManager().leaveChatRoom(forward_msg.getTo());
}
}
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:40,代码来源:EaseChatFragment.java
示例12: updateMessageBody
import com.hyphenate.chat.EMTextMessageBody; //导入依赖的package包/类
private void updateMessageBody(EMMessage emMessage) {
EMMessageBody body = emMessage.getBody();
if (body instanceof EMTextMessageBody) {
mSendMessage.setText(((EMTextMessageBody) body).getMessage());
} else {
mSendMessage.setText(getContext().getString(R.string.no_text_message));
}
}
开发者ID:Vicent9920,项目名称:FanChat,代码行数:9,代码来源:SendMessageItemView.java
示例13: updateLastMessage
import com.hyphenate.chat.EMTextMessageBody; //导入依赖的package包/类
private void updateLastMessage(EMConversation emConversation) {
EMMessage emMessage = emConversation.getLastMessage();
if (emMessage.getBody() instanceof EMTextMessageBody) {
mLastMessage.setText(((EMTextMessageBody) emMessage.getBody()).getMessage());
} else {
mLastMessage.setText(getContext().getString(R.string.no_text_message));
}
mTimestamp.setText(DateUtils.getTimestampString(new Date(emMessage.getMsgTime())));
}
开发者ID:Vicent9920,项目名称:FanChat,代码行数:10,代码来源:ConversationItemView.java
示例14: updateMessageBody
import com.hyphenate.chat.EMTextMessageBody; //导入依赖的package包/类
private void updateMessageBody(EMMessage emMessage) {
EMMessageBody body = emMessage.getBody();
if (body instanceof EMTextMessageBody) {
mReceiveMessage.setText(((EMTextMessageBody) body).getMessage());
} else {
mReceiveMessage.setText(getContext().getString(R.string.no_text_message));
}
}
开发者ID:Vicent9920,项目名称:FanChat,代码行数:9,代码来源:ReceiveMessageItemView.java
示例15: forwardMessage
import com.hyphenate.chat.EMTextMessageBody; //导入依赖的package包/类
/**
* forward message
*
* @param forward_msg_id
*/
protected void forwardMessage(String forward_msg_id) {
final EMMessage forward_msg = EMClient.getInstance().chatManager().getMessage(forward_msg_id);
EMMessage.Type type = forward_msg.getType();
switch (type) {
case TXT:
if (forward_msg.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_BIG_EXPRESSION, false)) {
sendBigExpressionMessage(((EMTextMessageBody) forward_msg.getBody()).getMessage(),
forward_msg.getStringAttribute(EaseConstant.MESSAGE_ATTR_EXPRESSION_ID, null));
} else {
// get the content and send it
String content = ((EMTextMessageBody) forward_msg.getBody()).getMessage();
sendTextMessage(content);
}
break;
case IMAGE:
// send image
String filePath = ((EMImageMessageBody) forward_msg.getBody()).getLocalUrl();
if (filePath != null) {
File file = new File(filePath);
if (!file.exists()) {
// send thumb nail if original image does not exist
filePath = ((EMImageMessageBody) forward_msg.getBody()).thumbnailLocalPath();
}
sendImageMessage(filePath);
}
break;
default:
break;
}
if (forward_msg.getChatType() == ChatType.ChatRoom) {
EMClient.getInstance().chatroomManager().leaveChatRoom(forward_msg.getTo());
}
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:40,代码来源:EaseChatFragment.java
示例16: onSetUpView
import com.hyphenate.chat.EMTextMessageBody; //导入依赖的package包/类
@Override
public void onSetUpView() {
EMTextMessageBody txtBody = (EMTextMessageBody) message.getBody();
Spannable span = EaseSmileUtils.getSmiledText(context, txtBody.getMessage());
String money = message.getStringAttribute("transfer", "");
// 设置内容
if (StringUtils.isNotEmpty(money)) {
contentView.setText(money);
} else {
contentView.setText("0.0");
}
handleTextMessage();
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:16,代码来源:EaseChatRowSendMoney.java
示例17: onBubbleClick
import com.hyphenate.chat.EMTextMessageBody; //导入依赖的package包/类
@Override
protected void onBubbleClick() {
// TODO Auto-generated method stub
if (null != mBack) {
if (message.direct() == EMMessage.Direct.SEND) {
return;
}
mBack.back(message.getIntAttribute("redPacketID", 0), true, message.getStringAttribute("transfer", ""), ((EMTextMessageBody) message.getBody()).getMessage(),
message.getStringAttribute("name", ""), message.getFrom()
);
}
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:14,代码来源:EaseChatRowSendMoney.java
示例18: onSetUpView
import com.hyphenate.chat.EMTextMessageBody; //导入依赖的package包/类
@Override
public void onSetUpView() {
EMTextMessageBody txtBody = (EMTextMessageBody) message.getBody();
Spannable span = EaseSmileUtils.getSmiledText(context, txtBody.getMessage());
String money = message.getStringAttribute("transferMoney ", "");
// 设置内容
if (StringUtils.isNotEmpty(money)) {
contentView.setText(money);
} else {
contentView.setText("0.0");
}
handleTextMessage();
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:15,代码来源:EaseChatRowRecSendMoney.java
示例19: onBubbleClick
import com.hyphenate.chat.EMTextMessageBody; //导入依赖的package包/类
@Override
protected void onBubbleClick() {
// TODO Auto-generated method stub
int redType = getTypeOfred(message);
switch (redType) {
case 0:
break;
case 1:
break;
case 2:
if (message.direct() == EMMessage.Direct.SEND) {
return;
} else {
// if (null != mBack){
// mBack.back(message.getIntAttribute("redPacketID", 0), true, message.getStringAttribute("transfer", ""), ((EMTextMessageBody) message.getBody()).getMessage(),
// message.getStringAttribute("name", ""), message.getFrom()
// );
// }
getRedPacket(message.getIntAttribute("redPacketID", 0), true, message.getStringAttribute("transfer", ""), ((EMTextMessageBody) message.getBody()).getMessage(), message.getStringAttribute("name", ""), message.getFrom());
}
break;
case 3:
if (message.direct() == EMMessage.Direct.SEND) {
return;
} else {
getRedPacket(message.getIntAttribute("redPacketID", 0), false, message.getStringAttribute("transfer", ""), ((EMTextMessageBody) message.getBody()).getMessage(), message.getStringAttribute("name", ""), message.getFrom());
}
break;
case 4:
getRedPacket(message.getIntAttribute("redPacketID", 0), false, message.getStringAttribute("transfer", ""), ((EMTextMessageBody) message.getBody()).getMessage(), message.getStringAttribute("name", ""), message.getFrom());
break;
}
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:39,代码来源:EaseChatRowText.java
示例20: getView
import com.hyphenate.chat.EMTextMessageBody; //导入依赖的package包/类
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
Holder holder;
if(view ==null){
view = LayoutInflater.from(getActivity()).inflate(R.layout.item_msg,viewGroup,false);
holder = new Holder(view);
view.setTag(holder);
}else{
holder = (Holder) view.getTag();
}
EMConversation conversation = EMClient.getInstance().chatManager().getConversation(list.get(i));
EMMessage message = conversation.getLastMessage();
String msg = "";
if (message.getType().name().equals("TXT")) {
EMTextMessageBody body = (EMTextMessageBody) message.getBody();
msg = body.getMessage();
}
int count = conversation.getUnreadMsgCount();
if(count == 0){
holder.tvCount.setVisibility(View.GONE);
}else{
holder.tvCount.setVisibility(View.VISIBLE);
holder.tvCount.setText(count+"");
}
holder.tvName.setText(list.get(i));
holder.tvMsg.setText(msg);
holder.tvTime.setText(T.getTime(message.getMsgTime()));
return view;
}
开发者ID:jiangzehui,项目名称:HX,代码行数:34,代码来源:MsgFragment.java
注:本文中的com.hyphenate.chat.EMTextMessageBody类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论