当前位置: 首页>>代码示例>>Java>>正文


Java ImageMessage类代码示例

本文整理汇总了Java中io.rong.message.ImageMessage的典型用法代码示例。如果您正苦于以下问题:Java ImageMessage类的具体用法?Java ImageMessage怎么用?Java ImageMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ImageMessage类属于io.rong.message包,在下文中一共展示了ImageMessage类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onMessageClick

import io.rong.message.ImageMessage; //导入依赖的package包/类
@Override
    public boolean onMessageClick(Context context, View view, Message message) {
        LogHelper.e("omg", "onMessageClick" + context.getClass().getName());
        if (message != null && message.getContent() != null) {
            if (message.getContent() instanceof LocationMessage) {
                LocationMessage locationMessage = ((LocationMessage) message.getContent());
                LogHelper.e("omg", "LocationMessage" + locationMessage.getLat() + "|" + locationMessage.getLng());
//                BillActivity.start(context);
                GaoDeMapActivity.startShow(context, locationMessage.getLat(), locationMessage.getLng(), locationMessage.getPoi());
                LogHelper.e("omg", "LocationMessage end");
                return true;
            } else if (message.getContent() instanceof ImageMessage) {
                ImageMessage imageMessage = ((ImageMessage) message.getContent());
//                Intent intent = new Intent();
//                intent.setAction(android.content.Intent.ACTION_VIEW);
//                intent.setDataAndType(imageMessage.getLocalUri(), "image/*");
//                context.startActivity(intent);
                ImageActivity.start(context, imageMessage.getRemoteUri());
                return true;
            }
        }
        return false;
    }
 
开发者ID:MoonRune,项目名称:CuiTrip,代码行数:24,代码来源:RongCloudEvent.java

示例2: onMessageClick

import io.rong.message.ImageMessage; //导入依赖的package包/类
@Override
public boolean onMessageClick(final Context context, final View view, final Message message) {
    //real-time location message end
    /**
     * demo 代码  开发者需替换成自己的代码。
     */
    if (message.getContent() instanceof ImageMessage) {
        /*Intent intent = new Intent(context, PhotoActivity.class);
        intent.putExtra("message", message);
        context.startActivity(intent);*/
    }

    return false;
}
 
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:15,代码来源:SealAppContext.java

示例3: setOnClick

import io.rong.message.ImageMessage; //导入依赖的package包/类
private void setOnClick(LQRViewHolderForRecyclerView helper, Message item, int position) {
    helper.getView(R.id.llError).setOnClickListener(v ->
            RongIMClient.getInstance().deleteMessages(new int[]{item.getMessageId()}, new RongIMClient.ResultCallback<Boolean>() {
                @Override
                public void onSuccess(Boolean aBoolean) {
                    mData.remove(position);
                    mPresenter.setAdapter();
                    MessageContent content = item.getContent();
                    if (content instanceof TextMessage) {
                        mPresenter.sendTextMsg(((TextMessage) content).getContent());
                    } else if (content instanceof ImageMessage) {
                        mPresenter.sendImgMsg(((ImageMessage) content).getThumUri(), ((ImageMessage) content).getLocalUri());
                    } else if (content instanceof FileMessage) {
                        mPresenter.sendFileMsg(new File(((FileMessage) content).getLocalPath().getPath()));
                    } else if (content instanceof VoiceMessage) {
                        VoiceMessage voiceMessage = (VoiceMessage) content;
                        mPresenter.sendAudioFile(voiceMessage.getUri(), voiceMessage.getDuration());
                    }
                }

                @Override
                public void onError(RongIMClient.ErrorCode errorCode) {

                }
            })
    );
    helper.getView(R.id.ivAvatar).setOnClickListener(v -> {
        UserInfo userInfo = DBManager.getInstance().getUserInfo(item.getSenderUserId());
        if (userInfo != null) {
            Intent intent = new Intent(mContext, UserInfoActivity.class);
            intent.putExtra("userInfo", userInfo);
            ((SessionActivity) mContext).jumpToActivity(intent);
        }
    });
}
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:36,代码来源:SessionAdapter.java

示例4: getItemViewType

import io.rong.message.ImageMessage; //导入依赖的package包/类
@Override
public int getItemViewType(int position) {
    Message msg = mData.get(position);
    boolean isSend = msg.getMessageDirection() == Message.MessageDirection.SEND ? true : false;

    MessageContent msgContent = msg.getContent();
    if (msgContent instanceof TextMessage) {
        return isSend ? SEND_TEXT : RECEIVE_TEXT;
    }
    if (msgContent instanceof ImageMessage) {
        return isSend ? SEND_IMAGE : RECEIVE_IMAGE;
    }
    if (msgContent instanceof FileMessage) {
        FileMessage fileMessage = (FileMessage) msgContent;
        if (MediaFileUtils.isImageFileType(fileMessage.getName())) {
            return isSend ? SEND_STICKER : RECEIVE_STICKER;
        } else if (MediaFileUtils.isVideoFileType(fileMessage.getName())) {
            return isSend ? SEND_VIDEO : RECEIVE_VIDEO;
        }
    }
    if (msgContent instanceof LocationMessage) {
        return isSend ? SEND_LOCATION : RECEIVE_LOCATION;
    }
    if (msgContent instanceof GroupNotificationMessage) {
        return RECEIVE_NOTIFICATION;
    }
    if (msgContent instanceof VoiceMessage) {
        return isSend ? SEND_VOICE : RECEIVE_VOICE;
    }
    if (msgContent instanceof RedPacketMessage) {
        return isSend ? SEND_RED_PACKET : RECEIVE_RED_PACKET;
    }
    if (msgContent instanceof RecallNotificationMessage) {
        return RECALL_NOTIFICATION;
    }
    return UNDEFINE_MSG;
}
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:38,代码来源:SessionAdapter.java

示例5: getMessageContent

import io.rong.message.ImageMessage; //导入依赖的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

示例6: translateMessageContent

import io.rong.message.ImageMessage; //导入依赖的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

示例7: TranslatedImageMessage

import io.rong.message.ImageMessage; //导入依赖的package包/类
public TranslatedImageMessage(MessageContent content) {
    ImageMessage imageMessage = (ImageMessage) content;

    this.imageUrl = imageMessage.getRemoteUri() != null ?
                    imageMessage.getRemoteUri().toString() :
                    (imageMessage.getLocalUri() != null ? imageMessage.getLocalUri().getPath() : "");
    this.thumbPath = imageMessage.getThumUri() != null ? imageMessage.getThumUri().getPath() : "";
    this.extra = imageMessage.getExtra() == null ? "" : imageMessage.getExtra();
}
 
开发者ID:rongcloud,项目名称:apicloud-module-imlib-android,代码行数:10,代码来源:TranslatedImageMessage.java

示例8: onSent

import io.rong.message.ImageMessage; //导入依赖的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

示例9: onSent

import io.rong.message.ImageMessage; //导入依赖的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

示例10: onReceived

import io.rong.message.ImageMessage; //导入依赖的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.ImageMessage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。