From d130c1565ce5da617cd3183dcdc0e4d588d5ef65 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Mon, 18 Mar 2024 10:57:42 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E5=90=8D=E7=89=87=E5=9C=A8=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E4=B8=8A=E7=9A=84=E8=A1=A8=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../share/adapters/InternalShareAdapter.java | 5 +++++ .../com/yunbao/share/platform/Internal.java | 5 +++-- .../com/yunbao/share/ui/SharePopDialog.java | 4 ++-- .../message/content/MessageChatCardContent.java | 17 ++++++++++++++--- .../live/activity/LiveAudienceActivity.java | 1 + .../adapter/MainConversationListAdapter.java | 10 ++++++++++ main/src/main/res/values-zh/strings.xml | 1 + main/src/main/res/values/strings.xml | 1 + 8 files changed, 37 insertions(+), 7 deletions(-) diff --git a/Share/src/main/java/com/yunbao/share/adapters/InternalShareAdapter.java b/Share/src/main/java/com/yunbao/share/adapters/InternalShareAdapter.java index d245fc1..8944dfc 100644 --- a/Share/src/main/java/com/yunbao/share/adapters/InternalShareAdapter.java +++ b/Share/src/main/java/com/yunbao/share/adapters/InternalShareAdapter.java @@ -3,6 +3,7 @@ package com.yunbao.share.adapters; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.CompoundButton; import android.widget.RadioButton; import android.widget.TextView; @@ -75,6 +76,10 @@ public class InternalShareAdapter extends RecyclerView.Adapter { + selectPosition = position; + notifyDataSetChanged(); + }); itemView.setOnClickListener(view -> { selectPosition = position; notifyDataSetChanged(); diff --git a/Share/src/main/java/com/yunbao/share/platform/Internal.java b/Share/src/main/java/com/yunbao/share/platform/Internal.java index fec9578..56cb0ec 100644 --- a/Share/src/main/java/com/yunbao/share/platform/Internal.java +++ b/Share/src/main/java/com/yunbao/share/platform/Internal.java @@ -36,7 +36,8 @@ public class Internal extends AbsShareInterface { } }).showDialog(); } - void sendMessage(ShareBean builder){ + + void sendMessage(ShareBean builder) { MessageChatCardContent.sendMessage(Conversation.ConversationType.PRIVATE, builder.getUid(), MessageChatCardContent.obtain( builder.getCover(), @@ -44,7 +45,7 @@ public class Internal extends AbsShareInterface { builder.getAnchorAvatar(), builder.getAnchorName(), builder.getAnchorId(), - "1", + builder.getShareType() + "", builder.getAnchorId() ), new OnSendMessageListener() { diff --git a/Share/src/main/java/com/yunbao/share/ui/SharePopDialog.java b/Share/src/main/java/com/yunbao/share/ui/SharePopDialog.java index 75b16ed..81fd552 100644 --- a/Share/src/main/java/com/yunbao/share/ui/SharePopDialog.java +++ b/Share/src/main/java/com/yunbao/share/ui/SharePopDialog.java @@ -27,8 +27,8 @@ import java.util.ArrayList; import java.util.List; public class SharePopDialog extends AbsDialogPopupWindow { - public static final int TYPE_LIVE = 0; - public static final int TYPE_DYNAMIC = 1; + public static final int TYPE_LIVE = 1; + public static final int TYPE_DYNAMIC = 0; private ShareAppAdapter adapter; private RecyclerView list; private RoundedImageView avatar; diff --git a/common/src/main/java/com/yunbao/common/message/content/MessageChatCardContent.java b/common/src/main/java/com/yunbao/common/message/content/MessageChatCardContent.java index 1383132..1137d1d 100644 --- a/common/src/main/java/com/yunbao/common/message/content/MessageChatCardContent.java +++ b/common/src/main/java/com/yunbao/common/message/content/MessageChatCardContent.java @@ -6,6 +6,7 @@ import android.os.Parcelable; import androidx.annotation.NonNull; import com.yunbao.common.interfaces.OnSendMessageListener; +import com.yunbao.common.utils.ToastUtil; import org.json.JSONException; import org.json.JSONObject; @@ -14,6 +15,7 @@ import java.io.UnsupportedEncodingException; import io.rong.common.ParcelUtils; import io.rong.imkit.IMCenter; +import io.rong.imlib.IRongCallback; import io.rong.imlib.MessageTag; import io.rong.imlib.RongIMClient; import io.rong.imlib.model.Conversation; @@ -31,20 +33,29 @@ public class MessageChatCardContent extends MessageContent implements Parcelable private String extraData; public static void sendMessage(Conversation.ConversationType type, String targetId, MessageChatCardContent tipsContent, OnSendMessageListener listener) { - IMCenter.getInstance().insertOutgoingMessage(type, targetId, Message.SentStatus.SENT, tipsContent, System.currentTimeMillis(), new RongIMClient.ResultCallback() { + ToastUtil.show("发送给:"+targetId); + Message message=Message.obtain(targetId, type,tipsContent); + IMCenter.getInstance().sendMessage(message,null,null,new IRongCallback.ISendMessageCallback(){ + + @Override + public void onAttached(Message message) { + + } + @Override public void onSuccess(Message message) { + ToastUtil.show("发送成功"); if (listener != null) { listener.onSuccess(null, null); } } @Override - public void onError(RongIMClient.ErrorCode e) { + public void onError(Message message, RongIMClient.ErrorCode e) { + ToastUtil.show("发送失败:"+e.getMessage()); if (listener != null) { listener.onError(e.code, e.msg); } - } }); } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 4a983c4..161c2b1 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -1463,6 +1463,7 @@ public class LiveAudienceActivity extends LiveActivity { new SharePopDialog(mContext) .setShareType(SharePopDialog.TYPE_LIVE) .setShareData(ShareBean.ShareBuilder.create() + .setShareType(SharePopDialog.TYPE_LIVE) .setUid(CommonAppConfig.getInstance().getUid()) .setCover(StringUtil.isEmpty(event.getBean().getImg()) ? event.getBean().getAvatar() : event.getBean().getImg()) .setTitle(StringUtil.isEmpty(event.getBean().getTitle()) ? event.getBean().getUserNiceName() : event.getBean().getTitle()) diff --git a/main/src/main/java/com/yunbao/main/adapter/MainConversationListAdapter.java b/main/src/main/java/com/yunbao/main/adapter/MainConversationListAdapter.java index 90a1d0f..835ab89 100644 --- a/main/src/main/java/com/yunbao/main/adapter/MainConversationListAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/MainConversationListAdapter.java @@ -2,6 +2,7 @@ package com.yunbao.main.adapter; import android.content.Context; import android.text.Html; +import android.text.SpannableString; import android.text.Spanned; import android.text.TextUtils; import android.util.Log; @@ -14,6 +15,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.message.content.MessageChatCardContent; import com.yunbao.common.utils.AppManager; import com.yunbao.common.utils.ListUtils; import com.yunbao.common.utils.StringUtil; @@ -30,6 +32,7 @@ import io.rong.imkit.conversationlist.model.BaseUiConversation; import io.rong.imkit.conversationlist.model.SingleConversation; import io.rong.imkit.utils.RouteUtils; import io.rong.imkit.widget.adapter.ViewHolder; +import io.rong.imlib.model.Conversation; public class MainConversationListAdapter extends ConversationListAdapter { public static final int TYPE_SEARCH_TITLE = 500; @@ -125,7 +128,14 @@ public class MainConversationListAdapter extends ConversationListAdapter { for (BaseUiConversation item : data) { BaseUiConversation cn = new SingleConversation(mContext, item.mCore); srcList.add(cn); + + if (item.mCore.getConversationType() == Conversation.ConversationType.PRIVATE) { + if (item.mCore.getLatestMessage() instanceof MessageChatCardContent) { + item.mConversationContent = new SpannableString(WordUtil.getNewString(R.string.activity_msg_chat_list_card)); + } + } } + super.setDataCollection(data); } diff --git a/main/src/main/res/values-zh/strings.xml b/main/src/main/res/values-zh/strings.xml index b2244e6..552011a 100644 --- a/main/src/main/res/values-zh/strings.xml +++ b/main/src/main/res/values-zh/strings.xml @@ -73,4 +73,5 @@ 在线 离线 + [名片] \ No newline at end of file diff --git a/main/src/main/res/values/strings.xml b/main/src/main/res/values/strings.xml index 764d71f..ec58876 100644 --- a/main/src/main/res/values/strings.xml +++ b/main/src/main/res/values/strings.xml @@ -73,4 +73,5 @@ Day Online Offline + [Card]