本文整理汇总了Java中io.rong.message.RichContentMessage类的典型用法代码示例。如果您正苦于以下问题:Java RichContentMessage类的具体用法?Java RichContentMessage怎么用?Java RichContentMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RichContentMessage类属于io.rong.message包,在下文中一共展示了RichContentMessage类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getColoredChattingRecord
import io.rong.message.RichContentMessage; //导入依赖的package包/类
public SpannableStringBuilder getColoredChattingRecord(String filterStr, MessageContent messageContent) {
SpannableStringBuilder messageText = new SpannableStringBuilder();
if (messageContent instanceof TextMessage) {
TextMessage textMessage = (TextMessage) messageContent;
String textMessageContent = textMessage.getContent();
messageText = getOmitColored(filterStr, textMessageContent, 0);
}
if (messageContent instanceof RichContentMessage) {
RichContentMessage richContentMessage = (RichContentMessage) messageContent;
String messageTitle = richContentMessage.getTitle();
messageText = getOmitColored(filterStr, messageTitle, 1);
if (messageText.length() == 0) {
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder("[链接] ");
spannableStringBuilder.append(messageTitle);
messageText = spannableStringBuilder;
}
}
if (messageContent instanceof FileMessage) {
FileMessage fileMessage = (FileMessage) messageContent;
String fileName = fileMessage.getName();
messageText = getOmitColored(filterStr, fileName, 2);
}
return messageText;
}
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:25,代码来源:CharacterParser.java
示例2: getMessageContent
import io.rong.message.RichContentMessage; //导入依赖的package包/类
public static String getMessageContent(MessageContent messageContent) {
String content = "";
if (messageContent instanceof TextMessage) {//文本消息
TextMessage textMessage = (TextMessage) messageContent;
content = textMessage.getContent();
} else if (messageContent instanceof ImageMessage) {//图片消息
ImageMessage imageMessage = (ImageMessage) messageContent;
content = PlatformUtil.getInstance().getString(R.string.im_default_message_image);
} else if (messageContent instanceof VoiceMessage) {//语音消息
VoiceMessage voiceMessage = (VoiceMessage) messageContent;
content = PlatformUtil.getInstance().getString(R.string.im_default_message_voice);
} else if (messageContent instanceof RichContentMessage) {//图文消息
RichContentMessage richContentMessage = (RichContentMessage) messageContent;
content = PlatformUtil.getInstance().getString(R.string.im_default_message_rich_text);
} else if (messageContent instanceof LocationMessage) {//图文消息
LocationMessage location = (LocationMessage) messageContent;
content = PlatformUtil.getInstance().getString(R.string.im_default_message_location_with_string_in, location.getPoi());
} else if (messageContent instanceof InformationNotificationMessage) {//小灰条消息
InformationNotificationMessage informationNotificationMessage = (InformationNotificationMessage) messageContent;
LogHelper.e(TAG, "onReceived-informationNotificationMessage:" + informationNotificationMessage.getMessage());
content = PlatformUtil.getInstance().getString(R.string.im_default_message_notificataion);
} else {
if (messageContent == null) {
content = PlatformUtil.getInstance().getString(R.string.send_message_with_name_below, "");
} else {
content = null;
}
LogHelper.e("omg", " receive push message other" + messageContent);
// content = "[通知]";
}
return content;
}
开发者ID:MoonRune,项目名称:CuiTrip,代码行数:34,代码来源:RongCloudEvent.java
示例3: translateMessageContent
import io.rong.message.RichContentMessage; //导入依赖的package包/类
public static TranslatedMessageContent translateMessageContent(MessageContent msgContent) {
TranslatedMessageContent content = null;
if (msgContent == null)
return null;
if (msgContent instanceof TextMessage) {
content = new TranslatedTextMessage(msgContent);
} else if (msgContent instanceof ImageMessage) {
content = new TranslatedImageMessage(msgContent);
} else if (msgContent instanceof VoiceMessage) {
content = new TranslatedVoiceMessage(msgContent);
} else if (msgContent instanceof RichContentMessage) {
content = new TranslatedRichContentMessage(msgContent);
} else if (msgContent instanceof CommandNotificationMessage) {
content = new TranslatedCommandNotificationMessage(msgContent);
} else if (msgContent instanceof LocationMessage) {
content = new TranslatedLocationMessage(msgContent);
} else if (msgContent instanceof InformationNotificationMessage) {
content = new TranslatedInformationNtfMessage(msgContent);
} else if (msgContent instanceof DiscussionNotificationMessage) {
content = new TranslatedDiscussionNtfMessage(msgContent);
} else if (msgContent instanceof CommandMessage) {
content = new TranslatedCommandMessage(msgContent);
} else if (msgContent instanceof ContactNotificationMessage) {
content = new TranslatedContactNtfMessage(msgContent);
} else if (msgContent instanceof ProfileNotificationMessage) {
content = new TranslatedProfileNtfMessage(msgContent);
} else if (msgContent instanceof GroupNotificationMessage) {
content = new TranslatedGrpNtfMessage(msgContent);
}
return content;
}
开发者ID:rongcloud,项目名称:apicloud-module-imlib-android,代码行数:33,代码来源:TranslatedMessage.java
示例4: TranslatedRichContentMessage
import io.rong.message.RichContentMessage; //导入依赖的package包/类
public TranslatedRichContentMessage(MessageContent content) {
RichContentMessage richContentMessage = (RichContentMessage)content;
this.extra = richContentMessage.getExtra() == null ? "" : richContentMessage.getExtra();
this.title = richContentMessage.getTitle() == null ? "" : richContentMessage.getTitle();
this.description = richContentMessage.getContent() == null ? "" : richContentMessage.getContent();
this.imageUrl = richContentMessage.getImgUrl() == null ? "" : richContentMessage.getImgUrl();
this.url = richContentMessage.getUrl() == null ? "" : richContentMessage.getUrl();
}
开发者ID:rongcloud,项目名称:apicloud-module-imlib-android,代码行数:9,代码来源:TranslatedRichContentMessage.java
示例5: onSent
import io.rong.message.RichContentMessage; //导入依赖的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;
}
开发者ID:birdcopy,项目名称:Android-Birdcopy-Application,代码行数:42,代码来源:RongCloudEvent.java
示例6: onSent
import io.rong.message.RichContentMessage; //导入依赖的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;
}
开发者ID:yangyunfeng666,项目名称:demo-app-android-v2-2.3.9,代码行数:42,代码来源:RongCloudEvent.java
示例7: onReceived
import io.rong.message.RichContentMessage; //导入依赖的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;
}
开发者ID:birdcopy,项目名称:Android-Birdcopy-Application,代码行数:74,代码来源:RongCloudEvent.java
注:本文中的io.rong.message.RichContentMessage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论