Java Code Examples for com.easemob.chat.EMMessage#getBody()

The following examples show how to use com.easemob.chat.EMMessage#getBody() . 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: EaseChatRowVoicePlayClickListener.java    From monolog-android with MIT License 5 votes vote down vote up
public EaseChatRowVoicePlayClickListener(EMMessage message, ImageView v, ImageView iv_read_status, BaseAdapter adapter, Activity context) {
	this.message = message;
	voiceBody = (VoiceMessageBody) message.getBody();
	this.iv_read_status = iv_read_status;
	this.adapter = adapter;
	voiceIconView = v;
	this.activity = context;
	this.chatType = message.getChatType();
}
 
Example 2
Source File: VoicePlayClickListener.java    From FanXin-based-HuanXin with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 
 * @param message
 * @param v
 * @param iv_read_status
 * @param context
 * @param activity
 * @param user
 * @param chatType
 */
public VoicePlayClickListener(EMMessage message, ImageView v, ImageView iv_read_status, BaseAdapter adapter, Activity activity,
		String username) {
	this.message = message;
	voiceBody = (VoiceMessageBody) message.getBody();
	this.iv_read_status = iv_read_status;
	this.adapter = adapter;
	voiceIconView = v;
	this.activity = activity;
	this.chatType = message.getChatType();
}
 
Example 3
Source File: MessageAdapter.java    From FanXin-based-HuanXin with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 文本消息
 * 
 * @param message
 * @param holder
 * @param position
 */
private void handleTextMessage(EMMessage message, ViewHolder holder,
        final int position) {
    TextMessageBody txtBody = (TextMessageBody) message.getBody();
    Spannable span = SmileUtils
            .getSmiledText(context, txtBody.getMessage());
    // 设置内容
    holder.tv.setText(span, BufferType.SPANNABLE);
    // 设置长按事件监听
    // holder.tv.setOnLongClickListener(new OnLongClickListener() {
    // @Override
    // public boolean onLongClick(View v) {
    // activity.startActivityForResult((new Intent(activity,
    // ContextMenu.class)).putExtra("position", position)
    // .putExtra("type", EMMessage.Type.TXT.ordinal()),
    // ChatActivity.REQUEST_CODE_CONTEXT_MENU);
    // return true;
    // }
    // });

    if (message.direct == EMMessage.Direct.SEND) {
        switch (message.status) {
        case SUCCESS: // 发送成功
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.GONE);
            break;
        case FAIL: // 发送失败
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.VISIBLE);
            break;
        case INPROGRESS: // 发送中
            holder.pb.setVisibility(View.VISIBLE);
            holder.staus_iv.setVisibility(View.GONE);
            break;
        default:
            // 发送消息
            sendMsgInBackground(message, holder);
        }
    }
}
 
Example 4
Source File: VoicePlayClickListener.java    From school_shop with MIT License 5 votes vote down vote up
/**
 * 
 * @param message
 * @param v
 * @param iv_read_status
 * @param context
 * @param activity
 * @param user
 * @param chatType
 */
public VoicePlayClickListener(EMMessage message, ImageView v, ImageView iv_read_status, BaseAdapter adapter, Activity activity,
		String username) {
	this.message = message;
	voiceBody = (VoiceMessageBody) message.getBody();
	this.iv_read_status = iv_read_status;
	this.adapter = adapter;
	voiceIconView = v;
	this.activity = activity;
	this.chatType = message.getChatType();
}
 
Example 5
Source File: MessageAdapter.java    From school_shop with MIT License 5 votes vote down vote up
/**
 * 文本消息
 * 
 * @param message
 * @param holder
 * @param position
 */
private void handleTextMessage(EMMessage message, ViewHolder holder, final int position) {
	TextMessageBody txtBody = (TextMessageBody) message.getBody();
	Spannable span = SmileUtils.getSmiledText(context, txtBody.getMessage());
	// 设置内容
	holder.tv.setText(span, BufferType.SPANNABLE);
	// 设置长按事件监听
	holder.tv.setOnLongClickListener(new OnLongClickListener() {
		@Override
		public boolean onLongClick(View v) {
			activity.startActivityForResult(
					(new Intent(activity, ContextMenu.class)).putExtra("position", position).putExtra("type",
							EMMessage.Type.TXT.ordinal()), ChatActivity.REQUEST_CODE_CONTEXT_MENU);
			return true;
		}
	});

	if (message.direct == EMMessage.Direct.SEND) {
		switch (message.status) {
		case SUCCESS: // 发送成功
			holder.pb.setVisibility(View.GONE);
			holder.staus_iv.setVisibility(View.GONE);
			break;
		case FAIL: // 发送失败
			holder.pb.setVisibility(View.GONE);
			holder.staus_iv.setVisibility(View.VISIBLE);
			break;
		case INPROGRESS: // 发送中
			holder.pb.setVisibility(View.VISIBLE);
			holder.staus_iv.setVisibility(View.GONE);
			break;
		default:
			// 发送消息
			sendMsgInBackground(message, holder);
		}
	}
}
 
Example 6
Source File: MessageAdapter.java    From FanXin-based-HuanXin with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 处理位置消息
 * 
 * @param message
 * @param holder
 * @param position
 * @param convertView
 */
private void handleLocationMessage(final EMMessage message,
        final ViewHolder holder, final int position, View convertView) {
    TextView locationView = ((TextView) convertView
            .findViewById(R.id.tv_location));
    LocationMessageBody locBody = (LocationMessageBody) message.getBody();
    locationView.setText(locBody.getAddress());
    LatLng loc = new LatLng(locBody.getLatitude(), locBody.getLongitude());
    locationView.setOnClickListener(new MapClickListener(loc, locBody
            .getAddress()));
    // locationView.setOnLongClickListener(new OnLongClickListener() {
    // @Override
    // public boolean onLongClick(View v) {
    // activity.startActivityForResult((new Intent(activity,
    // ContextMenu.class)).putExtra("position", position)
    // .putExtra("type", EMMessage.Type.LOCATION.ordinal()),
    // ChatActivity.REQUEST_CODE_CONTEXT_MENU);
    // return false;
    // }
    // });

    if (message.direct == EMMessage.Direct.RECEIVE) {
        return;
    }
    // deal with send message
    switch (message.status) {
    case SUCCESS:
        holder.pb.setVisibility(View.GONE);
        holder.staus_iv.setVisibility(View.GONE);
        break;
    case FAIL:
        holder.pb.setVisibility(View.GONE);
        holder.staus_iv.setVisibility(View.VISIBLE);
        break;
    case INPROGRESS:
        holder.pb.setVisibility(View.VISIBLE);
        break;
    default:
        sendMsgInBackground(message, holder);
    }
}
 
Example 7
Source File: MessageAdapter.java    From FanXin-based-HuanXin with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 音视频通话记录
 * 
 * @param message
 * @param holder
 * @param position
 */
private void handleCallMessage(EMMessage message, ViewHolder holder,
        final int position) {
    TextMessageBody txtBody = (TextMessageBody) message.getBody();
    holder.tv.setText(txtBody.getMessage());

}
 
Example 8
Source File: MessageAdapter.java    From school_shop with MIT License 2 votes vote down vote up
/**
 * 音视频通话记录
 * 
 * @param message
 * @param holder
 * @param position
 */
private void handleCallMessage(EMMessage message, ViewHolder holder, final int position) {
	TextMessageBody txtBody = (TextMessageBody) message.getBody();
	holder.tv.setText(txtBody.getMessage());

}