NIMSDK-AOS  10.8.10
ChatRoomMessageBuilder.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.chatroom;
2 
3 import android.content.Context;
4 import android.net.Uri;
5 import android.text.TextUtils;
6 
7 import com.netease.nimlib.NimNosSceneKeyConstant;
8 import com.netease.nimlib.SDKCacheUI;
9 import com.netease.nimlib.chatroom.model.ChatRoomMessageImpl;
25 import com.netease.nimlib.util.BitmapDecoder;
26 import com.netease.nimlib.util.StringUtil;
27 import com.netease.nimlib.util.TimeUtil;
28 
29 import java.io.File;
30 
31 /**
32  * 聊天室消息构造器
33  */
34 public class ChatRoomMessageBuilder {
35 
36  /**
37  * 创建普通文本消息
38  *
39  * @param roomId 聊天室ID
40  * @param text 文本消息内容
41  * @return ChatRoomMessage 生成的聊天室消息对象
42  */
43  public static ChatRoomMessage createChatRoomTextMessage(String roomId, String text) {
44  ChatRoomMessageImpl msg = initSendMessage(roomId);
45  msg.setMsgType(MsgTypeEnum.text.getValue());
46  msg.setContent(text);
47 
48  return msg;
49  }
50 
51  /**
52  * 创建自定义消息
53  *
54  * @param roomId 聊天室ID
55  * @param attachment 消息附件对象
56  * @return ChatRoomMessage 生成的自定义消息对象
57  */
58  public static ChatRoomMessage createChatRoomCustomMessage(String roomId, MsgAttachment attachment) {
59  return createChatRoomCustomMessage(roomId, attachment, NimNosSceneKeyConstant.NIM_DEFAULT_IM);
60  }
61 
62  /**
63  * 创建自定义消息 另外指定指定文件上传(如果有)时使用的 nos scene
64  *
65  * @param roomId 聊天室ID
66  * @param attachment 消息附件对象
67  * @param nosTokenScene 文件上传(如果有)时使用的 nos scene
68  * @return ChatRoomMessage 生成的自定义消息对象
69  */
70  public static ChatRoomMessage createChatRoomCustomMessage(String roomId, MsgAttachment attachment, String nosTokenScene) {
71  ChatRoomMessageImpl msg = initSendMessage(roomId);
72  msg.setMsgType(MsgTypeEnum.custom.getValue());
73  if (attachment != null && attachment instanceof FileAttachment) {
74  ((FileAttachment) attachment).setNosTokenSceneKey(nosTokenScene);
75  }
76  msg.setAttachment(attachment);
77 
78  return msg;
79  }
80 
81  /**
82  * 创建一条图片消息
83  *
84  * @param roomId 聊天室ID
85  * @param file 图片文件
86  * @param displayName 图片文件的显示名,可不同于文件名
87  * @return ChatRoomMessage 生成的聊天室消息对象
88  */
89  public static ChatRoomMessage createChatRoomImageMessage(String roomId, File file, String displayName) {
90  return createChatRoomImageMessage(roomId, file, displayName, NimNosSceneKeyConstant.NIM_DEFAULT_IM);
91  }
92 
93  /**
94  * 创建一条图片消息
95  *
96  * @param context Context
97  * @param roomId 聊天室ID
98  * @param uri 图片uri
99  * @param displayName 图片文件的显示名,可不同于文件名
100  * @return ChatRoomMessage 生成的聊天室消息对象
101  */
102  public static ChatRoomMessage createChatRoomImageMessage(Context context,String roomId, Uri uri, String displayName) {
103  return createChatRoomImageMessage(context,roomId, uri, displayName, NimNosSceneKeyConstant.NIM_DEFAULT_IM);
104  }
105 
106 
107 
108  /**
109  * 创建一条图片消息 并指定图片上传时使用的 nos scene
110  *
111  * @param roomId 聊天室ID
112  * @param file 图片文件
113  * @param displayName 图片文件的显示名,可不同于文件名
114  * @param nosTokenSceneKey 图片上传时使用的 nos scene ,默认为 {@link NimNosSceneKeyConstant#NIM_DEFAULT_IM}
115  * @return ChatRoomMessage 生成的聊天室消息对象
116  */
117  public static ChatRoomMessage createChatRoomImageMessage(String roomId, File file, String displayName, String nosTokenSceneKey) {
118  ChatRoomMessageImpl msg = initSendMessage(roomId);
119  msg.setMsgType(MsgTypeEnum.image.getValue());
120 
121  final ImageAttachment attachment = MessageBuilder.createImageAttachment(file, displayName,nosTokenSceneKey);
122  msg.setAttachment(attachment);
123 
124  return msg;
125  }
126 
127  /**
128  * 创建一条图片消息 并指定图片上传时使用的 nos scene
129  *
130  * @param roomId 聊天室ID
131  * @param uri 图片文件uri
132  * @param displayName 图片文件的显示名,可不同于文件名
133  * @param nosTokenSceneKey 图片上传时使用的 nos scene ,默认为 {@link NimNosSceneKeyConstant#NIM_DEFAULT_IM}
134  * @return ChatRoomMessage 生成的聊天室消息对象
135  */
136  public static ChatRoomMessage createChatRoomImageMessage(Context context,String roomId, Uri uri, String displayName, String nosTokenSceneKey) {
137  ChatRoomMessageImpl msg = initSendMessage(roomId);
138  msg.setMsgType(MsgTypeEnum.image.getValue());
139  final ImageAttachment attachment = MessageBuilder.createImageAttachment(context,uri,displayName,nosTokenSceneKey);
140  msg.setAttachment(attachment);
141 
142  return msg;
143  }
144 
145 
146  /**
147  * 创建一条音频消息
148  *
149  * @param roomId 聊天室ID
150  * @param file 音频文件对象
151  * @param duration 音频文件持续时间,单位是ms
152  * @return ChatRoomMessage 生成的聊天室消息对象
153  */
154  public static ChatRoomMessage createChatRoomAudioMessage(String roomId, File file, long duration) {
155  return createChatRoomAudioMessage(roomId, file, duration, NimNosSceneKeyConstant.NIM_DEFAULT_IM);
156  }
157 
158  /**
159  * 创建一条音频消息
160  *
161  * @param context Context
162  * @param roomId 聊天室ID
163  * @param uri 音频文件uri
164  * @param duration 音频文件持续时间,单位是ms
165  * @return ChatRoomMessage 生成的聊天室消息对象
166  */
167  public static ChatRoomMessage createChatRoomAudioMessage(Context context,String roomId, Uri uri, long duration) {
168  return createChatRoomAudioMessage(context,roomId, uri, duration, NimNosSceneKeyConstant.NIM_DEFAULT_IM);
169  }
170 
171  /**
172  * 创建一条音频消息 并指定音频文件上传时使用的 nos scene
173  *
174  * @param roomId 聊天室ID
175  * @param file 音频文件对象
176  * @param duration 音频文件持续时间,单位是ms
177  * @param nosTokenSceneKey 音频文件上传时使用的 nos scene ,默认为 {@link NimNosSceneKeyConstant#NIM_DEFAULT_IM}
178  * @return ChatRoomMessage 生成的聊天室消息对象
179  */
180  public static ChatRoomMessage createChatRoomAudioMessage(String roomId, File file, long duration, String nosTokenSceneKey) {
181  ChatRoomMessageImpl msg = initSendMessage(roomId);
182  msg.setMsgType(MsgTypeEnum.audio.getValue());
183  if (duration > 0 && duration < 1000) {
184  duration = 1000; // 最低显示1秒
185  }
186 
187  final AudioAttachment attachment = MessageBuilder.createAudioAttachment(file,duration,nosTokenSceneKey);
188  msg.setAttachment(attachment);
189 
190  return msg;
191  }
192 
193  /**
194  * 创建一条音频消息 并指定音频文件上传时使用的 nos scene
195  *
196  * @param context Context
197  * @param roomId 聊天室ID
198  * @param uri 音频文件uri
199  * @param duration 音频文件持续时间,单位是ms
200  * @param nosTokenSceneKey 音频文件上传时使用的 nos scene ,默认为 {@link NimNosSceneKeyConstant#NIM_DEFAULT_IM}
201  * @return ChatRoomMessage 生成的聊天室消息对象
202  */
203  public static ChatRoomMessage createChatRoomAudioMessage(Context context,String roomId, Uri uri, long duration, String nosTokenSceneKey) {
204  ChatRoomMessageImpl msg = initSendMessage(roomId);
205  msg.setMsgType(MsgTypeEnum.audio.getValue());
206  if (duration > 0 && duration < 1000) {
207  duration = 1000; // 最低显示1秒
208  }
209  final AudioAttachment attachment = MessageBuilder.createAudioAttachment(context,uri,duration,nosTokenSceneKey);
210  msg.setAttachment(attachment);
211 
212  return msg;
213  }
214 
215  /**
216  * 创建一条地理位置信息
217  *
218  * @param roomId 聊天室ID
219  * @param lat 维度
220  * @param lng 经度
221  * @param addr 地理位置描述信息
222  * @return ChatRoomMessage 生成的聊天室消息对象
223  */
224  public static ChatRoomMessage createChatRoomLocationMessage(String roomId, double lat, double lng, String addr) {
225  ChatRoomMessageImpl msg = initSendMessage(roomId);
226  msg.setMsgType(MsgTypeEnum.location.getValue());
227 
228  final LocationAttachment location = new LocationAttachment();
229  location.setLatitude(lat);
230  location.setLongitude(lng);
231  location.setAddress(addr);
232  msg.setAttachStatus(AttachStatusEnum.transferred);
233  msg.setAttachment(location);
234 
235  return msg;
236  }
237 
238  /**
239  * 创建一条视频消息
240  *
241  * @param roomId 聊天室ID
242  * @param file 视频文件对象
243  * @param duration 视频文件持续时间
244  * @param width 视频宽度
245  * @param height 视频高度
246  * @param displayName 视频文件显示名,可以为空
247  * @return ChatRoomMessage 生成的聊天室消息对象
248  */
249  public static ChatRoomMessage createChatRoomVideoMessage(String roomId, File file, long duration, int width, int height, String displayName) {
250  return createChatRoomVideoMessage(roomId, file, duration, width, height, displayName, NimNosSceneKeyConstant.NIM_DEFAULT_IM);
251  }
252 
253  /**
254  * 创建一条视频消息
255  *
256  * @param context Context
257  * @param roomId 聊天室ID
258  * @param uri 视频文件uri
259  * @param duration 视频文件持续时间
260  * @param width 视频宽度
261  * @param height 视频高度
262  * @param displayName 视频文件显示名,可以为空
263  * @return ChatRoomMessage 生成的聊天室消息对象
264  */
265  public static ChatRoomMessage createChatRoomVideoMessage(Context context,String roomId, Uri uri, long duration, int width, int height, String displayName) {
266  return createChatRoomVideoMessage(context,roomId, uri, duration, width, height, displayName, NimNosSceneKeyConstant.NIM_DEFAULT_IM);
267  }
268 
269  /**
270  * 创建一条视频消息 并指定视频文件上传时使用的 nos scene
271  *
272  * @param roomId 聊天室ID
273  * @param file 视频文件对象
274  * @param duration 视频文件持续时间
275  * @param width 视频宽度
276  * @param height 视频高度
277  * @param displayName 视频文件显示名,可以为空
278  * @param nosTokenSceneKey 视频文件上传时使用的 nos scene ,默认为 {@link NimNosSceneKeyConstant#NIM_DEFAULT_IM}
279  * @return ChatRoomMessage 生成的聊天室消息对象
280  */
281  public static ChatRoomMessage createChatRoomVideoMessage(String roomId, File file, long duration, int width, int height, String displayName, String nosTokenSceneKey) {
282  ChatRoomMessageImpl msg = initSendMessage(roomId);
283  msg.setMsgType(MsgTypeEnum.video.getValue());
284 
285  final VideoAttachment attachment = MessageBuilder.createVideoAttachment(file, duration, width, height, displayName,nosTokenSceneKey);
286  msg.setAttachment(attachment);
287 
288  BitmapDecoder.extractThumbnail(file.getPath(), attachment.getThumbPathForSave());
289 
290  return msg;
291  }
292 
293  /**
294  * 创建一条视频消息 并指定视频文件上传时使用的 nos scene
295  *
296  * @param context Context
297  * @param roomId 聊天室ID
298  * @param uri 视频文件uri
299  * @param duration 视频文件持续时间
300  * @param width 视频宽度
301  * @param height 视频高度
302  * @param displayName 视频文件显示名,可以为空
303  * @param nosTokenSceneKey 视频文件上传时使用的 nos scene ,默认为 {@link NimNosSceneKeyConstant#NIM_DEFAULT_IM}
304  * @return ChatRoomMessage 生成的聊天室消息对象
305  */
306  @SuppressWarnings("java:S107")
307  public static ChatRoomMessage createChatRoomVideoMessage(Context context,String roomId, Uri uri, long duration, int width, int height, String displayName, String nosTokenSceneKey) {
308  ChatRoomMessageImpl msg = initSendMessage(roomId);
309  msg.setMsgType(MsgTypeEnum.video.getValue());
310 
311  final VideoAttachment attachment = MessageBuilder.createVideoAttachment(context,uri, duration, width, height, displayName,nosTokenSceneKey);
312  msg.setAttachment(attachment);
313 
314  BitmapDecoder.extractThumbnail(uri, attachment.getThumbPathForSave());
315 
316  return msg;
317  }
318 
319  /**
320  * 创建一条文件消息
321  *
322  * @param roomId 聊天室ID
323  * @param file 文件
324  * @param displayName 文件的显示名,可不同于文件名
325  * @return ChatRoomMessage 生成的聊天室消息对象
326  */
327  public static ChatRoomMessage createChatRoomFileMessage(String roomId, File file, String displayName) {
328  return createChatRoomFileMessage(roomId, file, displayName, NimNosSceneKeyConstant.NIM_DEFAULT_IM);
329  }
330 
331  /**
332  * 创建一条文件消息 并指定文件上传时使用的 nos scene
333  *
334  * @param context Context
335  * @param roomId 聊天室ID
336  * @param uri 文件uri
337  * @param displayName 文件的显示名,可不同于文件名
338  * @return ChatRoomMessage 生成的聊天室消息对象
339  */
340  public static ChatRoomMessage createChatRoomFileMessage(Context context,String roomId, Uri uri, String displayName) {
341  ChatRoomMessageImpl msg = initSendMessage(roomId);
342  msg.setMsgType(MsgTypeEnum.file.getValue());
343 
344  final FileAttachment attachment = MessageBuilder.createFileAttachment(context, uri, displayName, NimNosSceneKeyConstant.NIM_DEFAULT_IM);
345  msg.setAttachment(attachment);
346  return msg;
347  }
348 
349  /**
350  * 创建一条文件消息 并指定文件上传时使用的 nos scene
351  *
352  * @param roomId 聊天室ID
353  * @param file 文件
354  * @param displayName 文件的显示名,可不同于文件名
355  * @param nosTokenSceneKey 文件上传时使用的 nos scene ,默认为 {@link NimNosSceneKeyConstant#NIM_DEFAULT_IM}
356  * @return ChatRoomMessage 生成的聊天室消息对象
357  */
358  public static ChatRoomMessage createChatRoomFileMessage(String roomId, File file, String displayName, String nosTokenSceneKey) {
359  ChatRoomMessageImpl msg = initSendMessage(roomId);
360  msg.setMsgType(MsgTypeEnum.file.getValue());
361 
362  final FileAttachment attachment = MessageBuilder.createFileAttachment(file, displayName, nosTokenSceneKey);
363  msg.setAttachment(attachment);
364  return msg;
365  }
366 
367  /**
368  * 创建一条文件消息 并指定文件上传时使用的 nos scene
369  *
370  * @param context Context
371  * @param roomId 聊天室ID
372  * @param uri 文件uri
373  * @param displayName 文件的显示名,可不同于文件名
374  * @param nosTokenSceneKey 文件上传时使用的 nos scene ,默认为 {@link NimNosSceneKeyConstant#NIM_DEFAULT_IM}
375  * @return ChatRoomMessage 生成的聊天室消息对象
376  */
377  public static ChatRoomMessage createChatRoomFileMessage(Context context,String roomId, Uri uri, String displayName, String nosTokenSceneKey) {
378  ChatRoomMessageImpl msg = initSendMessage(roomId);
379  msg.setMsgType(MsgTypeEnum.file.getValue());
380 
381  final FileAttachment attachment = MessageBuilder.createFileAttachment(context, uri, displayName, nosTokenSceneKey);
382  msg.setAttachment(attachment);
383  return msg;
384  }
385 
386  /**
387  * 创建普通文本消息
388  *
389  * @param roomId 聊天室ID
390  * @param text 文本消息内容
391  * @param x 坐标X
392  * @param y 坐标Y
393  * @param z 坐标Z
394  * @return ChatRoomMessage 生成的聊天室消息对象
395  */
396  public static ChatRoomMessage createChatRoomSpatialLocationTextMessage(String roomId, String text,Double x,Double y,Double z) {
397  ChatRoomMessageImpl msg = initSendMessage(roomId);
398  msg.setMsgType(MsgTypeEnum.text.getValue());
399  msg.setContent(text);
400  msg.setLocX(x);
401  msg.setLocY(y);
402  msg.setLocZ(z);
403  return msg;
404  }
405 
406  /**
407  * 创建一条提醒消息
408  *
409  * @param roomId 聊天室ID
410  * @return ChatRoomMessage 生成的聊天室消息对象
411  */
412  public static ChatRoomMessage createTipMessage(String roomId) {
413  ChatRoomMessageImpl msg = initSendMessage(roomId);
414  msg.setMsgType(MsgTypeEnum.tip.getValue());
415 
416  return msg;
417  }
418 
419  /**
420  * @param roomId 聊天室ID
421  * @param robotAccount 机器人账号
422  * @param text 消息显示的文案,一般基于content加上@机器人的标签作为消息显示的文案。
423  * @param type 机器人消息类型,参考{@link com.netease.nimlib.sdk.robot.model.RobotMsgType}
424  * @param content 消息内容,如果消息类型是{@link com.netease.nimlib.sdk.robot.model.RobotMsgType#TEXT},必须传入说话内容
425  * @param target 如果消息类型是{@link com.netease.nimlib.sdk.robot.model.RobotMsgType#LINK}, 必须传入跳转目标
426  * @param params 如果消息类型是{@link com.netease.nimlib.sdk.robot.model.RobotMsgType#LINK}时,可能需要传入参数
427  * @return 机器人消息
428  */
429  public static ChatRoomMessage createRobotMessage(String roomId, String robotAccount, String text, String type, String content, String target, String params) {
430  if (TextUtils.isEmpty(type) || TextUtils.isEmpty(robotAccount)) {
431  throw new IllegalArgumentException("Invalid param, type and robot account should not be null");
432  }
433 
434  if (type.equals(RobotMsgType.TEXT) && content == null) {
435  throw new IllegalArgumentException("Invalid param, content should not be null");
436  } else if (type.equals(RobotMsgType.LINK) && TextUtils.isEmpty(target)) {
437  throw new IllegalArgumentException("Invalid param, target should not be null");
438  }
439 
440  ChatRoomMessageImpl msg = initSendMessage(roomId);
441  msg.setMsgType(MsgTypeEnum.robot.getValue());
442 
443  // build attachment
444  RobotAttachment robotAttachment = new RobotAttachment();
445  robotAttachment.initSend(robotAccount, type, content, target, params);
446  msg.setAttachment(robotAttachment);
447  msg.setContent(text); // 文案显示用,便于全文检索等
448 
449  return msg;
450  }
451 
452  /**
453  * 创建一条空消息,仅设置了房间ID以及时间点,用于记录查询
454  *
455  * @param time 查询的时间起点信息
456  * @return 空消息
457  */
458  public static ChatRoomMessage createEmptyChatRoomMessage(String roomId, long time) {
459  ChatRoomMessageImpl msg = new ChatRoomMessageImpl();
460  msg.setSessionId(roomId);
461  msg.setSessionType(SessionTypeEnum.ChatRoom);
462  msg.setTime(time);
463 
464  return msg;
465  }
466 
467  private final static ChatRoomMessageImpl initSendMessage(String roomId) {
468  ChatRoomMessageImpl msg = new ChatRoomMessageImpl();
469  msg.setUuid(StringUtil.get32UUID());
470  msg.setSessionId(roomId);
471  msg.setFromAccount(SDKCacheUI.getChatRoomAccount());
472  msg.setDirect(MsgDirectionEnum.Out);
473  msg.setStatus(MsgStatusEnum.sending);
474  msg.setSessionType(SessionTypeEnum.ChatRoom);
475  msg.setTime(TimeUtil.currentTimeMillis());
476 
477  return msg;
478  }
479 }
static ChatRoomMessage createChatRoomSpatialLocationTextMessage(String roomId, String text, Double x, Double y, Double z)
创建普通文本消息
static ChatRoomMessage createChatRoomTextMessage(String roomId, String text)
创建普通文本消息
static ChatRoomMessage createChatRoomVideoMessage(String roomId, File file, long duration, int width, int height, String displayName, String nosTokenSceneKey)
创建一条视频消息 并指定视频文件上传时使用的 nos scene
static ChatRoomMessage createChatRoomCustomMessage(String roomId, MsgAttachment attachment, String nosTokenScene)
创建自定义消息 另外指定指定文件上传(如果有)时使用的 nos scene
.annotation.NonNull static FileAttachment createFileAttachment(File file, String displayName, String nosTokenSceneKey)
创建文件附件。用于上传文件。
static ChatRoomMessage createChatRoomImageMessage(Context context, String roomId, Uri uri, String displayName)
创建一条图片消息
static ChatRoomMessage createChatRoomAudioMessage(String roomId, File file, long duration, String nosTokenSceneKey)
创建一条音频消息 并指定音频文件上传时使用的 nos scene
static ChatRoomMessage createChatRoomImageMessage(Context context, String roomId, Uri uri, String displayName, String nosTokenSceneKey)
创建一条图片消息 并指定图片上传时使用的 nos scene
.annotation.NonNull static VideoAttachment createVideoAttachment(File file, long duration, int width, int height, String displayName, String nosTokenSceneKey)
创建视频附件。用于上传视频文件。
云信 IM 消息构造器,提供构建各类型消息的接口。
带有文件的附件类型的基类 描述文件的相关信息
消息本身发送/接收状态,附件状态见AttachStatusEnum
static ChatRoomMessage createChatRoomImageMessage(String roomId, File file, String displayName, String nosTokenSceneKey)
创建一条图片消息 并指定图片上传时使用的 nos scene
static ChatRoomMessage createChatRoomFileMessage(String roomId, File file, String displayName)
创建一条文件消息
static ChatRoomMessage createTipMessage(String roomId)
创建一条提醒消息
static ChatRoomMessage createChatRoomVideoMessage(String roomId, File file, long duration, int width, int height, String displayName)
创建一条视频消息
.annotation.NonNull static AudioAttachment createAudioAttachment(File file, long duration, String nosTokenSceneKey)
创建音频附件。用于上传音频文件。
.annotation.NonNull static ImageAttachment createImageAttachment(File file, String displayName, String nosTokenSceneKey)
创建图片附件,用于上传图片文件。
void initSend(String robotAccount, String type, String content, String target, String params)
String getThumbPathForSave()
获取用于保存缩略图文件的位置
static ChatRoomMessage createChatRoomFileMessage(Context context, String roomId, Uri uri, String displayName, String nosTokenSceneKey)
创建一条文件消息 并指定文件上传时使用的 nos scene
static ChatRoomMessage createChatRoomVideoMessage(Context context, String roomId, Uri uri, long duration, int width, int height, String displayName)
创建一条视频消息
void setAddress(String address)
设置地理位置描述信息
static ChatRoomMessage createEmptyChatRoomMessage(String roomId, long time)
创建一条空消息,仅设置了房间ID以及时间点,用于记录查询
static ChatRoomMessage createChatRoomCustomMessage(String roomId, MsgAttachment attachment)
创建自定义消息
static ChatRoomMessage createChatRoomAudioMessage(String roomId, File file, long duration)
创建一条音频消息
static ChatRoomMessage createChatRoomLocationMessage(String roomId, double lat, double lng, String addr)
创建一条地理位置信息
static ChatRoomMessage createChatRoomFileMessage(String roomId, File file, String displayName, String nosTokenSceneKey)
创建一条文件消息 并指定文件上传时使用的 nos scene
static ChatRoomMessage createChatRoomFileMessage(Context context, String roomId, Uri uri, String displayName)
创建一条文件消息 并指定文件上传时使用的 nos scene
static ChatRoomMessage createChatRoomAudioMessage(Context context, String roomId, Uri uri, long duration, String nosTokenSceneKey)
创建一条音频消息 并指定音频文件上传时使用的 nos scene
static ChatRoomMessage createRobotMessage(String roomId, String robotAccount, String text, String type, String content, String target, String params)
static ChatRoomMessage createChatRoomImageMessage(String roomId, File file, String displayName)
创建一条图片消息
static ChatRoomMessage createChatRoomAudioMessage(Context context, String roomId, Uri uri, long duration)
创建一条音频消息