• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Message类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: loadMoreChattingRecords

import io.rong.imlib.model.Message; //导入依赖的package包/类
private void loadMoreChattingRecords() {
    Conversation conversation = mResult.getConversation();
    RongIMClient.getInstance().searchMessages(conversation.getConversationType(),
    conversation.getTargetId(), mFilterString, 50, mLastMessage.getSentTime(), new RongIMClient.ResultCallback<List<Message>>() {
        @Override
        public void onSuccess(List<Message> messages) {
            mCompleteFlag = true;
            mMessageShowCount = mMessageShowCount + messages.size();
            if (mMatchCount >= mMessageShowCount) {
                mAdapterMessages.addAll(messages);
                mAdapter.notifyDataSetChanged();
            }
            if (messages.size() > 0) {
                mLastMessage = messages.get(messages.size() - 1);
            }
        }

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

        }
    });

}
 
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:25,代码来源:SealSearchChattingDetailActivity.java


示例2: bindView

import io.rong.imlib.model.Message; //导入依赖的package包/类
@Override
public void bindView(View v, int position, ContactMessage content, UIMessage message) {
    ViewHolder viewHolder = (ViewHolder) v.getTag();
    if (content.getImgUrl() != null) {
        viewHolder.mImage.setResource(content.getImgUrl(), 0);
    }

    SpannableStringBuilder spannable = new SpannableStringBuilder(content.getName());
    AndroidEmoji.ensure(spannable);
    viewHolder.mName.setText(spannable);

    if (message.getMessageDirection() == Message.MessageDirection.RECEIVE)
        viewHolder.mLayout.setBackgroundResource(R.drawable.rc_ic_bubble_left_file);
    else
        viewHolder.mLayout.setBackgroundResource(R.drawable.rc_ic_bubble_right_file);
}
 
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:17,代码来源:ContactMessageItemProvider.java


示例3: setTime

import io.rong.imlib.model.Message; //导入依赖的package包/类
private void setTime(LQRViewHolderForRecyclerView helper, Message item, int position) {
    boolean isSend = item.getMessageDirection() == Message.MessageDirection.SEND ? true : false;
    long msgTime = isSend ? item.getSentTime() : item.getReceivedTime();
    if (position > 0) {
        Message preMsg = mData.get(position - 1);
        boolean isSendForPreMsg = preMsg.getMessageDirection() == Message.MessageDirection.SEND ? true : false;
        long preMsgTime = isSendForPreMsg ? preMsg.getSentTime() : preMsg.getReceivedTime();
        if (msgTime - preMsgTime > (5 * 60 * 1000)) {
            helper.setViewVisibility(R.id.tvTime, View.VISIBLE).setText(R.id.tvTime, TimeUtils.getMsgFormatTime(msgTime));
        } else {
            helper.setViewVisibility(R.id.tvTime, View.GONE);
        }
    } else {
        helper.setViewVisibility(R.id.tvTime, View.VISIBLE).setText(R.id.tvTime, TimeUtils.getMsgFormatTime(msgTime));
    }
}
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:17,代码来源:SessionAdapter.java


示例4: updateMessageStatus

import io.rong.imlib.model.Message; //导入依赖的package包/类
private void updateMessageStatus(int messageId) {
    RongIMClient.getInstance().getMessage(messageId, new RongIMClient.ResultCallback<Message>() {
        @Override
        public void onSuccess(Message message) {
            for (int i = 0; i < mData.size(); i++) {
                Message msg = mData.get(i);
                if (msg.getMessageId() == message.getMessageId()) {
                    mData.remove(i);
                    mData.add(i, message);
                    mAdapter.notifyDataSetChangedWrapper();
                    break;
                }
            }
        }

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

        }
    });
}
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:22,代码来源:SessionAtPresenter.java


示例5: getLocalHistoryMessage

import io.rong.imlib.model.Message; //导入依赖的package包/类
public void getLocalHistoryMessage() {
    //没有消息第一次调用应设置为:-1。
    int messageId = -1;
    if (mData.size() > 0) {
        messageId = mData.get(0).getMessageId();
    } else {
        messageId = -1;
    }

    RongIMClient.getInstance().getHistoryMessages(mConversationType, mSessionId, messageId, mMessageCount, new RongIMClient.ResultCallback<List<Message>>() {
        @Override
        public void onSuccess(List<Message> messages) {
            getView().getRefreshLayout().endRefreshing();
            if (messages == null || messages.size() == 0)
                getRemoteHistoryMessages();
            else
                saveHistoryMsg(messages);
        }

        @Override
        public void onError(RongIMClient.ErrorCode errorCode) {
            getView().getRefreshLayout().endRefreshing();
            loadMessageError(errorCode);
        }
    });
}
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:27,代码来源:SessionAtPresenter.java


示例6: getRemoteHistoryMessages

import io.rong.imlib.model.Message; //导入依赖的package包/类
public void getRemoteHistoryMessages() {
    //消息中的 sentTime;第一次可传 0,获取最新 count 条。
    long dateTime = 0;
    if (mData.size() > 0) {
        dateTime = mData.get(0).getSentTime();
    } else {
        dateTime = 0;
    }

    RongIMClient.getInstance().getRemoteHistoryMessages(mConversationType, mSessionId, dateTime, mMessageCount,
            new RongIMClient.ResultCallback<List<Message>>() {
                @Override
                public void onSuccess(List<Message> messages) {
                    saveHistoryMsg(messages);
                }

                @Override
                public void onError(RongIMClient.ErrorCode errorCode) {
                    loadMessageError(errorCode);
                }
            });
}
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:23,代码来源:SessionAtPresenter.java


示例7: onMessageClick

import io.rong.imlib.model.Message; //导入依赖的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


示例8: notifyIfNeed

import io.rong.imlib.model.Message; //导入依赖的package包/类
private void notifyIfNeed(UZModuleContext context, Message message, int left) {

        if (isInQuietTime(mContext)) {
            return;
        }

        RongIMClient.getInstance().getConversationNotificationStatus(message.getConversationType(), message.getTargetId(), new RongIMClient.ResultCallback<Conversation.ConversationNotificationStatus>() {
            @Override
            public void onSuccess(Conversation.ConversationNotificationStatus conversationNotificationStatus) {
                if (Conversation.ConversationNotificationStatus.NOTIFY == conversationNotificationStatus) {
                    sendNotification();
                }
            }

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

            }
        });
    }
 
开发者ID:rongcloud,项目名称:apicloud-module-imlib-android,代码行数:21,代码来源:RongIMClientModule.java


示例9: bindView

import io.rong.imlib.model.Message; //导入依赖的package包/类
@Override
public void bindView(final View v, int position, final TestMessage content, final UIMessage data) {
    ViewHolder holder = (ViewHolder) v.getTag();

    if (data.getMessageDirection() == Message.MessageDirection.SEND) {
        holder.message.setBackgroundResource(io.rong.imkit.R.drawable.rc_ic_bubble_right);
    } else {
        holder.message.setBackgroundResource(io.rong.imkit.R.drawable.rc_ic_bubble_left);
    }

    final AutoLinkTextView textView = holder.message;
    textView.setText(content.getContent());

    holder.message.setMovementMethod(new LinkTextViewMovementMethod(new ILinkClickListener() {
        @Override
        public boolean onLinkClick(String link) {
            RongIM.ConversationBehaviorListener listener = RongContext.getInstance().getConversationBehaviorListener();
            boolean result = false;
            if (listener != null) {
                result = listener.onMessageLinkClick(v.getContext(), link);
            }
            if (listener == null || !result) {
                String str = link.toLowerCase();
                if (str.startsWith("http") || str.startsWith("https")) {
                    Intent intent = new Intent(RongKitIntent.RONG_INTENT_ACTION_WEBVIEW);
                    intent.setPackage(v.getContext().getPackageName());
                    intent.putExtra("url", link);
                    v.getContext().startActivity(intent);
                    result = true;
                }
            }
            return result;
        }
    }));
}
 
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:36,代码来源:TestMessageProvider.java


示例10: onMessageClick

import io.rong.imlib.model.Message; //导入依赖的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


示例11: convert

import io.rong.imlib.model.Message; //导入依赖的package包/类
@Override
public void convert(LQRViewHolderForRecyclerView helper, Message item, int position) {
    setTime(helper, item, position);
    setView(helper, item, position);
    if (!(item.getContent() instanceof GroupNotificationMessage) && !(item.getContent() instanceof RecallNotificationMessage) && (getItemViewType(position) != UNDEFINE_MSG)) {
        setAvatar(helper, item, position);
        setName(helper, item, position);
        setStatus(helper, item, position);
        setOnClick(helper, item, position);
    }
}
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:12,代码来源:SessionAdapter.java


示例12: setOnClick

import io.rong.imlib.model.Message; //导入依赖的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


示例13: setAvatar

import io.rong.imlib.model.Message; //导入依赖的package包/类
private void setAvatar(LQRViewHolderForRecyclerView helper, Message item, int position) {
    ImageView ivAvatar = helper.getView(R.id.ivAvatar);
    UserInfo userInfo = DBManager.getInstance().getUserInfo(item.getSenderUserId());
    if (userInfo != null) {
        Glide.with(mContext).load(userInfo.getPortraitUri()).centerCrop().into(ivAvatar);
    }
}
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:8,代码来源:SessionAdapter.java


示例14: setName

import io.rong.imlib.model.Message; //导入依赖的package包/类
private void setName(LQRViewHolderForRecyclerView helper, Message item, int position) {
        if (item.getConversationType() == Conversation.ConversationType.PRIVATE) {
            helper.setViewVisibility(R.id.tvName, View.GONE);
        } else {
            helper.setViewVisibility(R.id.tvName, View.GONE);
//                    .setText(R.id.tvName, item.getContent().getUserInfo().getName());
        }
    }
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:9,代码来源:SessionAdapter.java


示例15: getItemViewType

import io.rong.imlib.model.Message; //导入依赖的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


示例16: saveHistoryMsg

import io.rong.imlib.model.Message; //导入依赖的package包/类
private void saveHistoryMsg(List<Message> messages) {
    //messages的时间顺序从新到旧排列,所以必须反过来加入到mData中
    if (messages != null && messages.size() > 0) {
        for (Message msg : messages) {
            mData.add(0, msg);
        }
        getView().getRvMsg().moveToPosition(messages.size() - 1);
    }
}
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:10,代码来源:SessionAtPresenter.java


示例17: recallMessageFromListener

import io.rong.imlib.model.Message; //导入依赖的package包/类
public void recallMessageFromListener(int messageId, RecallNotificationMessage recallNotificationMessage) {
    for (int i = 0; i < mData.size(); i++) {
        Message message = mData.get(i);
        if (message.getMessageId() == messageId) {
            recallMessageAndInsertMessage(recallNotificationMessage, i);
            break;
        }
    }
}
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:10,代码来源:SessionAtPresenter.java



注:本文中的io.rong.imlib.model.Message类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Server类代码示例发布时间:2022-05-21
下一篇:
Java Envelope类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap