Java Code Examples for com.hyphenate.chat.EMMessage.ChatType#Chat
The following examples show how to use
com.hyphenate.chat.EMMessage.ChatType#Chat .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EaseChatRowImage.java From Social with Apache License 2.0 | 6 votes |
@Override protected void onBubbleClick() { Intent intent = new Intent(context, EaseShowBigImageActivity.class); File file = new File(imgBody.getLocalUrl()); if (file.exists()) { Uri uri = Uri.fromFile(file); intent.putExtra("uri", uri); } else { // The local full size pic does not exist yet. // ShowBigImage needs to download it from the server // first intent.putExtra("secret", imgBody.getSecret()); intent.putExtra("remotepath", imgBody.getRemoteUrl()); intent.putExtra("localUrl", imgBody.getLocalUrl()); } if (message != null && message.direct() == EMMessage.Direct.RECEIVE && !message.isAcked() && message.getChatType() == ChatType.Chat) { try { EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId()); } catch (Exception e) { e.printStackTrace(); } } context.startActivity(intent); }
Example 2
Source File: EaseChatRowFile.java From Social with Apache License 2.0 | 6 votes |
@Override protected void onBubbleClick() { String filePath = fileMessageBody.getLocalUrl(); File file = new File(filePath); if (file != null && file.exists()) { // 文件存在,直接打开 FileUtils.openFile(file, (Activity) context); } else { // 下载 context.startActivity(new Intent(context, EaseShowNormalFileActivity.class).putExtra("msgbody", message.getBody())); } if (message.direct() == EMMessage.Direct.RECEIVE && !message.isAcked() && message.getChatType() == ChatType.Chat) { try { EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId()); } catch (HyphenateException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
Example 3
Source File: EaseChatRowVideo.java From Social with Apache License 2.0 | 6 votes |
@Override protected void onBubbleClick() { EMVideoMessageBody videoBody = (EMVideoMessageBody) message.getBody(); EMLog.d(TAG, "video view is on click"); Intent intent = new Intent(context, EaseShowVideoActivity.class); intent.putExtra("localpath", videoBody.getLocalUrl()); intent.putExtra("secret", videoBody.getSecret()); intent.putExtra("remotepath", videoBody.getRemoteUrl()); if (message != null && message.direct() == EMMessage.Direct.RECEIVE && !message.isAcked() && message.getChatType() == ChatType.Chat) { try { EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId()); } catch (Exception e) { e.printStackTrace(); } } activity.startActivity(intent); }
Example 4
Source File: EaseChatRowImage.java From Study_Android_Demo with Apache License 2.0 | 6 votes |
@Override protected void onBubbleClick() { Intent intent = new Intent(context, EaseShowBigImageActivity.class); File file = new File(imgBody.getLocalUrl()); if (file.exists()) { Uri uri = Uri.fromFile(file); intent.putExtra("uri", uri); } else { // The local full size pic does not exist yet. // ShowBigImage needs to download it from the server // first String msgId = message.getMsgId(); intent.putExtra("messageId", msgId); intent.putExtra("localUrl", imgBody.getLocalUrl()); } if (message != null && message.direct() == EMMessage.Direct.RECEIVE && !message.isAcked() && message.getChatType() == ChatType.Chat) { try { EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId()); } catch (Exception e) { e.printStackTrace(); } } context.startActivity(intent); }
Example 5
Source File: EaseChatRowFile.java From Study_Android_Demo with Apache License 2.0 | 6 votes |
@Override protected void onBubbleClick() { String filePath = fileMessageBody.getLocalUrl(); File file = new File(filePath); if (file.exists()) { // open files if it exist FileUtils.openFile(file, (Activity) context); } else { // download the file context.startActivity(new Intent(context, EaseShowNormalFileActivity.class).putExtra("msgbody", message.getBody())); } if (message.direct() == EMMessage.Direct.RECEIVE && !message.isAcked() && message.getChatType() == ChatType.Chat) { try { EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId()); } catch (HyphenateException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
Example 6
Source File: EaseChatRowVideo.java From Study_Android_Demo with Apache License 2.0 | 6 votes |
@Override protected void onBubbleClick() { EMVideoMessageBody videoBody = (EMVideoMessageBody) message.getBody(); EMLog.d(TAG, "video view is on click"); Intent intent = new Intent(context, EaseShowVideoActivity.class); intent.putExtra("localpath", videoBody.getLocalUrl()); intent.putExtra("secret", videoBody.getSecret()); intent.putExtra("remotepath", videoBody.getRemoteUrl()); if (message != null && message.direct() == EMMessage.Direct.RECEIVE && !message.isAcked() && message.getChatType() == ChatType.Chat) { try { EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId()); } catch (Exception e) { e.printStackTrace(); } } activity.startActivity(intent); }
Example 7
Source File: EaseChatRowLocation.java From Social with Apache License 2.0 | 5 votes |
@Override protected void onSetUpView() { locBody = (EMLocationMessageBody) message.getBody(); locationView.setText(locBody.getAddress()); // deal with send message if (message.direct() == EMMessage.Direct.SEND) { setMessageSendCallback(); switch (message.status()) { case CREATE: progressBar.setVisibility(View.GONE); statusView.setVisibility(View.VISIBLE); // 发送消息 // sendMsgInBackground(message); break; case SUCCESS: // 发送成功 progressBar.setVisibility(View.GONE); statusView.setVisibility(View.GONE); break; case FAIL: // 发送失败 progressBar.setVisibility(View.GONE); statusView.setVisibility(View.VISIBLE); break; case INPROGRESS: // 发送中 progressBar.setVisibility(View.VISIBLE); statusView.setVisibility(View.GONE); break; default: break; } }else{ if(!message.isAcked() && message.getChatType() == ChatType.Chat){ try { EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId()); } catch (HyphenateException e) { e.printStackTrace(); } } } }
Example 8
Source File: EaseChatRowText.java From Social with Apache License 2.0 | 5 votes |
protected void handleTextMessage() { if (message.direct() == EMMessage.Direct.SEND) { setMessageSendCallback(); switch (message.status()) { case CREATE: progressBar.setVisibility(View.GONE); statusView.setVisibility(View.VISIBLE); // 发送消息 // sendMsgInBackground(message); break; case SUCCESS: // 发送成功 progressBar.setVisibility(View.GONE); statusView.setVisibility(View.GONE); break; case FAIL: // 发送失败 progressBar.setVisibility(View.GONE); statusView.setVisibility(View.VISIBLE); break; case INPROGRESS: // 发送中 progressBar.setVisibility(View.VISIBLE); statusView.setVisibility(View.GONE); break; default: break; } }else{ if(!message.isAcked() && message.getChatType() == ChatType.Chat){ try { EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId()); } catch (HyphenateException e) { e.printStackTrace(); } } } }
Example 9
Source File: EaseChatRowLocation.java From Study_Android_Demo with Apache License 2.0 | 5 votes |
@Override protected void onSetUpView() { locBody = (EMLocationMessageBody) message.getBody(); locationView.setText(locBody.getAddress()); // handle sending message if (message.direct() == EMMessage.Direct.SEND) { setMessageSendCallback(); switch (message.status()) { case CREATE: progressBar.setVisibility(View.GONE); statusView.setVisibility(View.VISIBLE); break; case SUCCESS: progressBar.setVisibility(View.GONE); statusView.setVisibility(View.GONE); break; case FAIL: progressBar.setVisibility(View.GONE); statusView.setVisibility(View.VISIBLE); break; case INPROGRESS: progressBar.setVisibility(View.VISIBLE); statusView.setVisibility(View.GONE); break; default: break; } }else{ if(!message.isAcked() && message.getChatType() == ChatType.Chat){ try { EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId()); } catch (HyphenateException e) { e.printStackTrace(); } } } }
Example 10
Source File: EaseChatRowText.java From Study_Android_Demo with Apache License 2.0 | 5 votes |
protected void handleTextMessage() { if (message.direct() == EMMessage.Direct.SEND) { setMessageSendCallback(); switch (message.status()) { case CREATE: progressBar.setVisibility(View.GONE); statusView.setVisibility(View.VISIBLE); break; case SUCCESS: progressBar.setVisibility(View.GONE); statusView.setVisibility(View.GONE); break; case FAIL: progressBar.setVisibility(View.GONE); statusView.setVisibility(View.VISIBLE); break; case INPROGRESS: progressBar.setVisibility(View.VISIBLE); statusView.setVisibility(View.GONE); break; default: break; } }else{ if(!message.isAcked() && message.getChatType() == ChatType.Chat){ try { EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId()); } catch (HyphenateException e) { e.printStackTrace(); } } } }
Example 11
Source File: EaseChatRowText.java From nono-android with GNU General Public License v3.0 | 5 votes |
protected void handleTextMessage() { if (message.direct() == EMMessage.Direct.SEND) { setMessageSendCallback(); switch (message.status()) { case CREATE: progressBar.setVisibility(View.GONE); statusView.setVisibility(View.VISIBLE); // 发送消息 // sendMsgInBackground(message); break; case SUCCESS: // 发送成功 progressBar.setVisibility(View.GONE); statusView.setVisibility(View.GONE); break; case FAIL: // 发送失败 progressBar.setVisibility(View.GONE); statusView.setVisibility(View.VISIBLE); break; case INPROGRESS: // 发送中 progressBar.setVisibility(View.VISIBLE); statusView.setVisibility(View.GONE); break; default: break; } }else{ if(!message.isAcked() && message.getChatType() == ChatType.Chat){ try { EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId()); } catch (HyphenateException e) { e.printStackTrace(); } } } }
Example 12
Source File: EaseChatRowVoicePlayClickListener.java From Social with Apache License 2.0 | 4 votes |
public void playVoice(String filePath) { if (!(new File(filePath).exists())) { return; } playMsgId = message.getMsgId(); AudioManager audioManager = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE); mediaPlayer = new MediaPlayer(); //--------------------------- //EaseUI.getInstance(); //--------------------------- if (EaseUI.getInstance().getSettingsProvider().isSpeakerOpened()) { audioManager.setMode(AudioManager.MODE_NORMAL); audioManager.setSpeakerphoneOn(true); mediaPlayer.setAudioStreamType(AudioManager.STREAM_RING); } else { audioManager.setSpeakerphoneOn(false);// 关闭扬声器 // 把声音设定成Earpiece(听筒)出来,设定为正在通话中 audioManager.setMode(AudioManager.MODE_IN_CALL); mediaPlayer.setAudioStreamType(AudioManager.STREAM_VOICE_CALL); } try { mediaPlayer.setDataSource(filePath); mediaPlayer.prepare(); mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { // TODO Auto-generated method stub mediaPlayer.release(); mediaPlayer = null; stopPlayVoice(); // stop animation } }); isPlaying = true; currentPlayListener = this; mediaPlayer.start(); showAnimation(); // 如果是接收的消息 if (message.direct() == EMMessage.Direct.RECEIVE) { if (!message.isAcked() && chatType == ChatType.Chat) { // 告知对方已读这条消息 EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId()); } if (!message.isListened() && iv_read_status != null && iv_read_status.getVisibility() == View.VISIBLE) { // 隐藏自己未播放这条语音消息的标志 iv_read_status.setVisibility(View.INVISIBLE); message.setListened(true); EMClient.getInstance().chatManager().setMessageListened(message); } } } catch (Exception e) { System.out.println(); } }
Example 13
Source File: EaseChatRowVoicePlayClickListener.java From Study_Android_Demo with Apache License 2.0 | 4 votes |
public void playVoice(String filePath) { if (!(new File(filePath).exists())) { return; } playMsgId = message.getMsgId(); AudioManager audioManager = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE); mediaPlayer = new MediaPlayer(); if (EaseUI.getInstance().getSettingsProvider().isSpeakerOpened()) { audioManager.setMode(AudioManager.MODE_NORMAL); audioManager.setSpeakerphoneOn(true); mediaPlayer.setAudioStreamType(AudioManager.STREAM_RING); } else { audioManager.setSpeakerphoneOn(false);// 关闭扬声器 // 把声音设定成Earpiece(听筒)出来,设定为正在通话中 audioManager.setMode(AudioManager.MODE_IN_CALL); mediaPlayer.setAudioStreamType(AudioManager.STREAM_VOICE_CALL); } try { mediaPlayer.setDataSource(filePath); mediaPlayer.prepare(); mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { // TODO Auto-generated method stub mediaPlayer.release(); mediaPlayer = null; stopPlayVoice(); // stop animation } }); isPlaying = true; currentPlayListener = this; mediaPlayer.start(); showAnimation(); // 如果是接收的消息 if (message.direct() == EMMessage.Direct.RECEIVE) { if (!message.isAcked() && chatType == ChatType.Chat) { // 告知对方已读这条消息 EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId()); } if (!message.isListened() && iv_read_status != null && iv_read_status.getVisibility() == View.VISIBLE) { // 隐藏自己未播放这条语音消息的标志 iv_read_status.setVisibility(View.INVISIBLE); message.setListened(true); EMClient.getInstance().chatManager().setMessageListened(message); } } } catch (Exception e) { System.out.println(); } }
Example 14
Source File: EaseChatRowVoicePlayClickListener.java From nono-android with GNU General Public License v3.0 | 4 votes |
public void playVoice(String filePath) { if (!(new File(filePath).exists())) { return; } playMsgId = message.getMsgId(); AudioManager audioManager = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE); mediaPlayer = new MediaPlayer(); if (EaseUI.getInstance().getSettingsProvider().isSpeakerOpened()) { audioManager.setMode(AudioManager.MODE_NORMAL); audioManager.setSpeakerphoneOn(true); mediaPlayer.setAudioStreamType(AudioManager.STREAM_RING); } else { audioManager.setSpeakerphoneOn(false);// 关闭扬声器 // 把声音设定成Earpiece(听筒)出来,设定为正在通话中 audioManager.setMode(AudioManager.MODE_IN_CALL); mediaPlayer.setAudioStreamType(AudioManager.STREAM_VOICE_CALL); } try { mediaPlayer.setDataSource(filePath); mediaPlayer.prepare(); mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { // TODO Auto-generated method stub mediaPlayer.release(); mediaPlayer = null; stopPlayVoice(); // stop animation } }); isPlaying = true; currentPlayListener = this; mediaPlayer.start(); showAnimation(); // 如果是接收的消息 if (message.direct() == EMMessage.Direct.RECEIVE) { if (!message.isAcked() && chatType == ChatType.Chat) { // 告知对方已读这条消息 EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId()); } if (!message.isListened() && iv_read_status != null && iv_read_status.getVisibility() == View.VISIBLE) { // 隐藏自己未播放这条语音消息的标志 iv_read_status.setVisibility(View.INVISIBLE); message.setListened(true); EMClient.getInstance().chatManager().setMessageListened(message); } } } catch (Exception e) { System.out.println(); } }