本文整理汇总了Java中io.rong.imlib.model.Message.getContent方法的典型用法代码示例。如果您正苦于以下问题:Java Message.getContent方法的具体用法?Java Message.getContent怎么用?Java Message.getContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.rong.imlib.model.Message
的用法示例。
在下文中一共展示了Message.getContent方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMessageClick
import io.rong.imlib.model.Message; //导入方法依赖的package包/类
@Override
public boolean onMessageClick(Context context, View view, Message message) {
LogHelper.e("omg", "onMessageClick" + context.getClass().getName());
if (message != null && message.getContent() != null) {
if (message.getContent() instanceof LocationMessage) {
LocationMessage locationMessage = ((LocationMessage) message.getContent());
LogHelper.e("omg", "LocationMessage" + locationMessage.getLat() + "|" + locationMessage.getLng());
// BillActivity.start(context);
GaoDeMapActivity.startShow(context, locationMessage.getLat(), locationMessage.getLng(), locationMessage.getPoi());
LogHelper.e("omg", "LocationMessage end");
return true;
} else if (message.getContent() instanceof ImageMessage) {
ImageMessage imageMessage = ((ImageMessage) message.getContent());
// Intent intent = new Intent();
// intent.setAction(android.content.Intent.ACTION_VIEW);
// intent.setDataAndType(imageMessage.getLocalUri(), "image/*");
// context.startActivity(intent);
ImageActivity.start(context, imageMessage.getRemoteUri());
return true;
}
}
return false;
}
示例2: onMessageClick
import io.rong.imlib.model.Message; //导入方法依赖的package包/类
@Override
public boolean onMessageClick(final Context context, final View view, final Message message) {
//real-time location message end
/**
* demo 代码 开发者需替换成自己的代码。
*/
if (message.getContent() instanceof ImageMessage) {
/*Intent intent = new Intent(context, PhotoActivity.class);
intent.putExtra("message", message);
context.startActivity(intent);*/
}
return false;
}
示例3: convert
import io.rong.imlib.model.Message; //导入方法依赖的package包/类
@Override
public void convert(LQRViewHolderForRecyclerView helper, Message item, int position) {
setTime(helper, item, position);
setView(helper, item, position);
if (!(item.getContent() instanceof GroupNotificationMessage) && !(item.getContent() instanceof RecallNotificationMessage) && (getItemViewType(position) != UNDEFINE_MSG)) {
setAvatar(helper, item, position);
setName(helper, item, position);
setStatus(helper, item, position);
setOnClick(helper, item, position);
}
}
示例4: getItemViewType
import io.rong.imlib.model.Message; //导入方法依赖的package包/类
@Override
public int getItemViewType(int position) {
Message msg = mData.get(position);
boolean isSend = msg.getMessageDirection() == Message.MessageDirection.SEND ? true : false;
MessageContent msgContent = msg.getContent();
if (msgContent instanceof TextMessage) {
return isSend ? SEND_TEXT : RECEIVE_TEXT;
}
if (msgContent instanceof ImageMessage) {
return isSend ? SEND_IMAGE : RECEIVE_IMAGE;
}
if (msgContent instanceof FileMessage) {
FileMessage fileMessage = (FileMessage) msgContent;
if (MediaFileUtils.isImageFileType(fileMessage.getName())) {
return isSend ? SEND_STICKER : RECEIVE_STICKER;
} else if (MediaFileUtils.isVideoFileType(fileMessage.getName())) {
return isSend ? SEND_VIDEO : RECEIVE_VIDEO;
}
}
if (msgContent instanceof LocationMessage) {
return isSend ? SEND_LOCATION : RECEIVE_LOCATION;
}
if (msgContent instanceof GroupNotificationMessage) {
return RECEIVE_NOTIFICATION;
}
if (msgContent instanceof VoiceMessage) {
return isSend ? SEND_VOICE : RECEIVE_VOICE;
}
if (msgContent instanceof RedPacketMessage) {
return isSend ? SEND_RED_PACKET : RECEIVE_RED_PACKET;
}
if (msgContent instanceof RecallNotificationMessage) {
return RECALL_NOTIFICATION;
}
return UNDEFINE_MSG;
}
示例5: onSent
import io.rong.imlib.model.Message; //导入方法依赖的package包/类
/**
* 消息在UI展示后执行/自己的消息发出后执行,无论成功或失败。
*
* @param message 消息。
*/
@Override
public boolean onSent(Message message, RongIM.SentMessageErrorCode sentMessageErrorCode) {
Log.e("qinxiao", "onSent:" + message.getObjectName() + ", extra=" + message.getExtra());
if (message.getSentStatus() == Message.SentStatus.FAILED) {
if (sentMessageErrorCode == RongIM.SentMessageErrorCode.NOT_IN_CHATROOM) {//不在聊天室
} else if (sentMessageErrorCode == RongIM.SentMessageErrorCode.NOT_IN_DISCUSSION) {//不在讨论组
} else if (sentMessageErrorCode == RongIM.SentMessageErrorCode.NOT_IN_GROUP) {//不在群组
} else if (sentMessageErrorCode == RongIM.SentMessageErrorCode.REJECTED_BY_BLACKLIST) {//你在他的黑名单中
//WinToast.toast(mContext, "你在对方的黑名单中");
}
}
MessageContent messageContent = message.getContent();
if (messageContent instanceof TextMessage) {//文本消息
TextMessage textMessage = (TextMessage) messageContent;
Log.e(TAG, "onSent-TextMessage:" + textMessage.getContent());
} else if (messageContent instanceof ImageMessage) {//图片消息
ImageMessage imageMessage = (ImageMessage) messageContent;
Log.d(TAG, "onSent-ImageMessage:" + imageMessage.getRemoteUri());
} else if (messageContent instanceof VoiceMessage) {//语音消息
VoiceMessage voiceMessage = (VoiceMessage) messageContent;
Log.d(TAG, "onSent-voiceMessage:" + voiceMessage.getUri().toString());
} else if (messageContent instanceof RichContentMessage) {//图文消息
RichContentMessage richContentMessage = (RichContentMessage) messageContent;
Log.d(TAG, "onSent-RichContentMessage:" + richContentMessage.getContent());
} else {
Log.d(TAG, "onSent-其他消息,自己来判断处理");
}
return false;
}
示例6: onSent
import io.rong.imlib.model.Message; //导入方法依赖的package包/类
/**
* 消息在UI展示后执行/自己的消息发出后执行,无论成功或失败。
*
* @param message 消息。
*/
@Override
public boolean onSent(Message message, RongIM.SentMessageErrorCode sentMessageErrorCode) {
Log.e("qinxiao", "onSent:" + message.getObjectName() + ", extra=" + message.getExtra());
if (message.getSentStatus() == Message.SentStatus.FAILED) {
if (sentMessageErrorCode == RongIM.SentMessageErrorCode.NOT_IN_CHATROOM) {//不在聊天室
} else if (sentMessageErrorCode == RongIM.SentMessageErrorCode.NOT_IN_DISCUSSION) {//不在讨论组
} else if (sentMessageErrorCode == RongIM.SentMessageErrorCode.NOT_IN_GROUP) {//不在群组
} else if (sentMessageErrorCode == RongIM.SentMessageErrorCode.REJECTED_BY_BLACKLIST) {//你在他的黑名单中
WinToast.toast(mContext, "你在对方的黑名单中");
}
}
MessageContent messageContent = message.getContent();
if (messageContent instanceof TextMessage) {//文本消息
TextMessage textMessage = (TextMessage) messageContent;
Log.e(TAG, "onSent-TextMessage:" + textMessage.getContent());
} else if (messageContent instanceof ImageMessage) {//图片消息
ImageMessage imageMessage = (ImageMessage) messageContent;
Log.d(TAG, "onSent-ImageMessage:" + imageMessage.getRemoteUri());
} else if (messageContent instanceof VoiceMessage) {//语音消息
VoiceMessage voiceMessage = (VoiceMessage) messageContent;
Log.d(TAG, "onSent-voiceMessage:" + voiceMessage.getUri().toString());
} else if (messageContent instanceof RichContentMessage) {//图文消息
RichContentMessage richContentMessage = (RichContentMessage) messageContent;
Log.d(TAG, "onSent-RichContentMessage:" + richContentMessage.getContent());
} else {
Log.d(TAG, "onSent-其他消息,自己来判断处理");
}
return false;
}
示例7: onReceived
import io.rong.imlib.model.Message; //导入方法依赖的package包/类
/**
* 接收消息的监听器:OnReceiveMessageListener 的回调方法,接收到消息后执行。
*
* @param message 接收到的消息的实体信息。
* @param left 剩余未拉取消息数目。
*/
@Override
public boolean onReceived(Message message, int left) {
MessageContent messageContent = message.getContent();
if (messageContent instanceof TextMessage) {//文本消息
TextMessage textMessage = (TextMessage) messageContent;
textMessage.getExtra();
Log.d(TAG, "onReceived-TextMessage:" + textMessage.getContent());
} else if (messageContent instanceof ImageMessage) {//图片消息
ImageMessage imageMessage = (ImageMessage) messageContent;
Log.d(TAG, "onReceived-ImageMessage:" + imageMessage.getRemoteUri());
} else if (messageContent instanceof VoiceMessage) {//语音消息
VoiceMessage voiceMessage = (VoiceMessage) messageContent;
Log.d(TAG, "onReceived-voiceMessage:" + voiceMessage.getUri().toString());
} else if (messageContent instanceof RichContentMessage) {//图文消息
RichContentMessage richContentMessage = (RichContentMessage) messageContent;
Log.d(TAG, "onReceived-RichContentMessage:" + richContentMessage.getContent());
} else if (messageContent instanceof InformationNotificationMessage) {//小灰条消息
InformationNotificationMessage informationNotificationMessage = (InformationNotificationMessage) messageContent;
Log.e(TAG, "onReceived-informationNotificationMessage:" + informationNotificationMessage.getMessage());
//if (FlyingIMContext.getInstance() != null)
// getFriendByUserIdHttpRequest = FlyingIMContext.getInstance().getUserInfoByUserId(message.getSenderUserId(), (ApiCallback<User>) this);
}
/*else if (messageContent instanceof AgreedFriendRequestMessage) {//好友添加成功消息
AgreedFriendRequestMessage agreedFriendRequestMessage = (AgreedFriendRequestMessage) messageContent;
Log.d(TAG, "onReceived-deAgreedFriendRequestMessage:" + agreedFriendRequestMessage.getMessage());
Intent in = new Intent();
in.setAction(MainActivity.ACTION_DMEO_AGREE_REQUEST);
in.putExtra("AGREE_REQUEST", true);
mContext.sendBroadcast(in);
} else if (messageContent instanceof ContactNotificationMessage) {//好友添加消息
ContactNotificationMessage contactContentMessage = (ContactNotificationMessage) messageContent;
Log.d(TAG, "onReceived-ContactNotificationMessage:getExtra;" + contactContentMessage.getExtra());
Log.d(TAG, "onReceived-ContactNotificationMessage:+getmessage:" + contactContentMessage.getMessage().toString());
Intent in = new Intent();
in.setAction(MainActivity.ACTION_DMEO_RECEIVE_MESSAGE);
in.putExtra("rongCloud", contactContentMessage);
in.putExtra("has_message", true);
mContext.sendBroadcast(in);
}
*/else if (messageContent instanceof DiscussionNotificationMessage) {//讨论组通知消息
DiscussionNotificationMessage discussionNotificationMessage = (DiscussionNotificationMessage) messageContent;
Log.d(TAG, "onReceived-discussionNotificationMessage:getExtra;" + discussionNotificationMessage.getOperator());
setDiscussionName(message.getTargetId());
} else {
Log.d(TAG, "onReceived-其他消息,自己来判断处理");
}
//通知更新菜单
Intent in = new Intent();
in.setAction(MainActivity.ACTION_RONGCLOUD_RECEIVE_MESSAGE);
in.putExtra("rongMessage", message);
in.putExtra("has_message", true);
mContext.sendBroadcast(in);
return false;
}
示例8: onSend
import io.rong.imlib.model.Message; //导入方法依赖的package包/类
/**
* 消息发送前监听器处理接口(是否发送成功可以从SentStatus属性获取)。
*
* @param message 发送的消息实例。
* @return 处理后的消息实例。
*/
@Override
public Message onSend(Message message) {
MessageContent messageContent = message.getContent();
if (messageContent instanceof TextMessage) {//文本消息
TextMessage textMessage = (TextMessage) messageContent;
Log.e("qinxiao", "--onSend:" + textMessage.getContent() + ", extra=" + message.getExtra());
}
return message;
}