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 d245fc17d..8944dfc9d 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 fec95780c..56cb0ec55 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 75b16edc1..81fd55240 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 138313281..1137d1d3d 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 4a983c46a..161c2b19e 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 90a1d0f96..835ab895e 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 b2244e61f..552011a0a 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 764d71f69..ec58876e5 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]