本文整理汇总了Java中com.hyphenate.chat.EMMessage.getBody方法的典型用法代码示例。如果您正苦于以下问题:Java EMMessage.getBody方法的具体用法?Java EMMessage.getBody怎么用?Java EMMessage.getBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hyphenate.chat.EMMessage
的用法示例。
在下文中一共展示了EMMessage.getBody方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.ease_showvideo_activity);
loadingLayout = (RelativeLayout) findViewById(R.id.loading_layout);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
final EMMessage message = getIntent().getParcelableExtra("msg");
if (!(message.getBody() instanceof EMVideoMessageBody)) {
Toast.makeText(EaseShowVideoActivity.this, "Unsupported message body", Toast.LENGTH_SHORT).show();
finish();
return;
}
EMVideoMessageBody messageBody = (EMVideoMessageBody)message.getBody();
localFilePath = messageBody.getLocalUrl();
if (localFilePath != null && new File(localFilePath).exists()) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(localFilePath)),
"video/mp4");
startActivity(intent);
finish();
} else {
EMLog.d(TAG, "download remote video file");
downloadVideo(message);
}
}
示例2: EaseChatRowVoicePlayClickListener
import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
public EaseChatRowVoicePlayClickListener(EMMessage message, ImageView v, ImageView iv_read_status, BaseAdapter adapter, Activity context) {
this.message = message;
voiceBody = (EMVoiceMessageBody) message.getBody();
this.iv_read_status = iv_read_status;
this.adapter = adapter;
voiceIconView = v;
this.activity = context;
this.chatType = message.getChatType();
}
示例3: onCmdMessageReceived
import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
public void onCmdMessageReceived(List<EMMessage> messages) {
//red packet code : 处理红包回执透传消息
for (EMMessage message : messages) {
EMCmdMessageBody cmdMsgBody = (EMCmdMessageBody) message.getBody();
final String action = cmdMsgBody.action();//获取自定义action
if (action.equals(RPConstant.REFRESH_GROUP_RED_PACKET_ACTION)) {
RedPacketUtil.receiveRedPacketAckMessage(message);
}
}
//end of red packet code
// refreshUIWithMessage();
refresh();
}
示例4: EaseChatRowVoicePlayClickListener
import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
public EaseChatRowVoicePlayClickListener(EMMessage message, ImageView v, ImageView iv_read_status, BaseAdapter adapter, Activity context) {
this.message = message;
voiceBody = (EMVoiceMessageBody) message.getBody();
this.iv_read_status = iv_read_status;
this.adapter = adapter;
voiceIconView = v;
this.activity = context;
this.chatType = message.getChatType();
}
示例5: onCmdMessageReceived
import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
public void onCmdMessageReceived(List<EMMessage> messages) {
//red packet code : 处理红包回执透传消息
for (EMMessage message : messages) {
EMCmdMessageBody cmdMsgBody = (EMCmdMessageBody) message.getBody();
String action = cmdMsgBody.action();//获取自定义action
if (action.equals(RPConstant.REFRESH_GROUP_RED_PACKET_ACTION)) {
RedPacketUtil.receiveRedPacketAckMessage(message);
messageList.refresh();
}
}
//end of red packet code
super.onCmdMessageReceived(messages);
}
示例6: updateMessageBody
import com.hyphenate.chat.EMMessage; //导入方法依赖的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));
}
}
示例7: updateLastMessage
import com.hyphenate.chat.EMMessage; //导入方法依赖的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())));
}
示例8: updateMessageBody
import com.hyphenate.chat.EMMessage; //导入方法依赖的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));
}
}
示例9: getMessageDigest
import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
/**
* Get digest according message type and content
*
* @param message
* @param context
* @return
*/
public static String getMessageDigest(EMMessage message, Context context) {
String digest = "";
switch (message.getType()) {
case LOCATION:
if (message.direct() == EMMessage.Direct.RECEIVE) {
digest = getString(context, R.string.location_recv);
digest = String.format(digest, message.getFrom());
return digest;
} else {
digest = getString(context, R.string.location_prefix);
}
break;
case IMAGE:
digest = getString(context, R.string.picture);
break;
case VOICE:
digest = getString(context, R.string.voice_prefix);
break;
case VIDEO:
digest = getString(context, R.string.video);
break;
case TXT:
EMTextMessageBody txtBody = (EMTextMessageBody) message.getBody();
if(message.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_VOICE_CALL, false)){
digest = getString(context, R.string.voice_call) + txtBody.getMessage();
}else if(message.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_VIDEO_CALL, false)){
digest = getString(context, R.string.video_call) + txtBody.getMessage();
}else if(message.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_BIG_EXPRESSION, false)){
if(!TextUtils.isEmpty(txtBody.getMessage())){
digest = txtBody.getMessage();
}else{
digest = getString(context, R.string.dynamic_expression);
}
}else{
digest = txtBody.getMessage();
}
break;
case FILE:
digest = getString(context, R.string.file);
break;
default:
EMLog.e(TAG, "error, unknow type");
return "";
}
return digest;
}
示例10: onCreate
import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ease_activity_show_file);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
final EMMessage message = getIntent().getParcelableExtra("msg");
if (!(message.getBody() instanceof EMFileMessageBody)) {
Toast.makeText(EaseShowNormalFileActivity.this, "Unsupported message body", Toast.LENGTH_SHORT).show();
finish();
return;
}
final File file = new File(((EMFileMessageBody)message.getBody()).getLocalUrl());
message.setMessageStatusCallback(new EMCallBack() {
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
public void run() {
FileUtils.openFile(file, EaseShowNormalFileActivity.this);
finish();
}
});
}
@Override
public void onError(int code, String error) {
runOnUiThread(new Runnable() {
public void run() {
if(file != null && file.exists()&&file.isFile())
file.delete();
String str4 = getResources().getString(R.string.Failed_to_download_file);
Toast.makeText(EaseShowNormalFileActivity.this, str4+message, Toast.LENGTH_SHORT).show();
finish();
}
});
}
@Override
public void onProgress(final int progress, String status) {
runOnUiThread(new Runnable() {
public void run() {
progressBar.setProgress(progress);
}
});
}
});
EMClient.getInstance().chatManager().downloadAttachment(message);
}
示例11: onCreate
import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ease_activity_show_file);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
final EMMessage message = getIntent().getParcelableExtra("msg");
if (!(message.getBody() instanceof EMFileMessageBody)) {
Toast.makeText(EaseShowNormalFileActivity.this, "Unsupported message body", Toast.LENGTH_SHORT).show();
finish();
return;
}
final File file = new File(((EMFileMessageBody)message.getBody()).getLocalUrl());
message.setMessageStatusCallback(new EMCallBack() {
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
public void run() {
FileUtils.openFile(file,EaseShowNormalFileActivity.this);
finish();
}
});
}
@Override
public void onError(int code, String error) {
runOnUiThread(new Runnable() {
public void run() {
if(file != null && file.exists()&&file.isFile())
file.delete();
String str4 = getResources().getString(R.string.Failed_to_download_file);
Toast.makeText(EaseShowNormalFileActivity.this, str4+message, Toast.LENGTH_SHORT).show();
finish();
}
});
}
@Override
public void onProgress(final int progress, String status) {
runOnUiThread(new Runnable() {
public void run() {
progressBar.setProgress(progress);
}
});
}
});
EMClient.getInstance().chatManager().downloadAttachment(message);
}