add 名片在列表上的表现

This commit is contained in:
zlzw 2024-03-18 10:57:42 +08:00
parent b3b46ccff3
commit d130c1565c
8 changed files with 37 additions and 7 deletions

View File

@ -3,6 +3,7 @@ package com.yunbao.share.adapters;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.TextView; import android.widget.TextView;
@ -75,6 +76,10 @@ public class InternalShareAdapter extends RecyclerView.Adapter<InternalShareAdap
} else { } else {
radioButton.setChecked(false); radioButton.setChecked(false);
} }
radioButton.setOnClickListener(view -> {
selectPosition = position;
notifyDataSetChanged();
});
itemView.setOnClickListener(view -> { itemView.setOnClickListener(view -> {
selectPosition = position; selectPosition = position;
notifyDataSetChanged(); notifyDataSetChanged();

View File

@ -36,7 +36,8 @@ public class Internal extends AbsShareInterface {
} }
}).showDialog(); }).showDialog();
} }
void sendMessage(ShareBean builder){
void sendMessage(ShareBean builder) {
MessageChatCardContent.sendMessage(Conversation.ConversationType.PRIVATE, builder.getUid(), MessageChatCardContent.sendMessage(Conversation.ConversationType.PRIVATE, builder.getUid(),
MessageChatCardContent.obtain( MessageChatCardContent.obtain(
builder.getCover(), builder.getCover(),
@ -44,7 +45,7 @@ public class Internal extends AbsShareInterface {
builder.getAnchorAvatar(), builder.getAnchorAvatar(),
builder.getAnchorName(), builder.getAnchorName(),
builder.getAnchorId(), builder.getAnchorId(),
"1", builder.getShareType() + "",
builder.getAnchorId() builder.getAnchorId()
), ),
new OnSendMessageListener<Object>() { new OnSendMessageListener<Object>() {

View File

@ -27,8 +27,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class SharePopDialog extends AbsDialogPopupWindow { public class SharePopDialog extends AbsDialogPopupWindow {
public static final int TYPE_LIVE = 0; public static final int TYPE_LIVE = 1;
public static final int TYPE_DYNAMIC = 1; public static final int TYPE_DYNAMIC = 0;
private ShareAppAdapter adapter; private ShareAppAdapter adapter;
private RecyclerView list; private RecyclerView list;
private RoundedImageView avatar; private RoundedImageView avatar;

View File

@ -6,6 +6,7 @@ import android.os.Parcelable;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.yunbao.common.interfaces.OnSendMessageListener; import com.yunbao.common.interfaces.OnSendMessageListener;
import com.yunbao.common.utils.ToastUtil;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -14,6 +15,7 @@ import java.io.UnsupportedEncodingException;
import io.rong.common.ParcelUtils; import io.rong.common.ParcelUtils;
import io.rong.imkit.IMCenter; import io.rong.imkit.IMCenter;
import io.rong.imlib.IRongCallback;
import io.rong.imlib.MessageTag; import io.rong.imlib.MessageTag;
import io.rong.imlib.RongIMClient; import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation; import io.rong.imlib.model.Conversation;
@ -31,20 +33,29 @@ public class MessageChatCardContent extends MessageContent implements Parcelable
private String extraData; private String extraData;
public static <T> void sendMessage(Conversation.ConversationType type, String targetId, MessageChatCardContent tipsContent, OnSendMessageListener<T> listener) { public static <T> void sendMessage(Conversation.ConversationType type, String targetId, MessageChatCardContent tipsContent, OnSendMessageListener<T> listener) {
IMCenter.getInstance().insertOutgoingMessage(type, targetId, Message.SentStatus.SENT, tipsContent, System.currentTimeMillis(), new RongIMClient.ResultCallback<Message>() { 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 @Override
public void onSuccess(Message message) { public void onSuccess(Message message) {
ToastUtil.show("发送成功");
if (listener != null) { if (listener != null) {
listener.onSuccess(null, null); listener.onSuccess(null, null);
} }
} }
@Override @Override
public void onError(RongIMClient.ErrorCode e) { public void onError(Message message, RongIMClient.ErrorCode e) {
ToastUtil.show("发送失败:"+e.getMessage());
if (listener != null) { if (listener != null) {
listener.onError(e.code, e.msg); listener.onError(e.code, e.msg);
} }
} }
}); });
} }

View File

@ -1463,6 +1463,7 @@ public class LiveAudienceActivity extends LiveActivity {
new SharePopDialog(mContext) new SharePopDialog(mContext)
.setShareType(SharePopDialog.TYPE_LIVE) .setShareType(SharePopDialog.TYPE_LIVE)
.setShareData(ShareBean.ShareBuilder.create() .setShareData(ShareBean.ShareBuilder.create()
.setShareType(SharePopDialog.TYPE_LIVE)
.setUid(CommonAppConfig.getInstance().getUid()) .setUid(CommonAppConfig.getInstance().getUid())
.setCover(StringUtil.isEmpty(event.getBean().getImg()) ? event.getBean().getAvatar() : event.getBean().getImg()) .setCover(StringUtil.isEmpty(event.getBean().getImg()) ? event.getBean().getAvatar() : event.getBean().getImg())
.setTitle(StringUtil.isEmpty(event.getBean().getTitle()) ? event.getBean().getUserNiceName() : event.getBean().getTitle()) .setTitle(StringUtil.isEmpty(event.getBean().getTitle()) ? event.getBean().getUserNiceName() : event.getBean().getTitle())

View File

@ -2,6 +2,7 @@ package com.yunbao.main.adapter;
import android.content.Context; import android.content.Context;
import android.text.Html; import android.text.Html;
import android.text.SpannableString;
import android.text.Spanned; import android.text.Spanned;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
@ -14,6 +15,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.message.content.MessageChatCardContent;
import com.yunbao.common.utils.AppManager; import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.ListUtils; import com.yunbao.common.utils.ListUtils;
import com.yunbao.common.utils.StringUtil; 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.conversationlist.model.SingleConversation;
import io.rong.imkit.utils.RouteUtils; import io.rong.imkit.utils.RouteUtils;
import io.rong.imkit.widget.adapter.ViewHolder; import io.rong.imkit.widget.adapter.ViewHolder;
import io.rong.imlib.model.Conversation;
public class MainConversationListAdapter extends ConversationListAdapter { public class MainConversationListAdapter extends ConversationListAdapter {
public static final int TYPE_SEARCH_TITLE = 500; public static final int TYPE_SEARCH_TITLE = 500;
@ -125,7 +128,14 @@ public class MainConversationListAdapter extends ConversationListAdapter {
for (BaseUiConversation item : data) { for (BaseUiConversation item : data) {
BaseUiConversation cn = new SingleConversation(mContext, item.mCore); BaseUiConversation cn = new SingleConversation(mContext, item.mCore);
srcList.add(cn); 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); super.setDataCollection(data);
} }

View File

@ -73,4 +73,5 @@
<string name="day"></string> <string name="day"></string>
<string name="activity_msg_chat_top_status_online">在线</string> <string name="activity_msg_chat_top_status_online">在线</string>
<string name="activity_msg_chat_top_status_offline">离线</string> <string name="activity_msg_chat_top_status_offline">离线</string>
<string name="activity_msg_chat_list_card">[名片]</string>
</resources> </resources>

View File

@ -73,4 +73,5 @@
<string name="day">Day</string> <string name="day">Day</string>
<string name="activity_msg_chat_top_status_online">Online</string> <string name="activity_msg_chat_top_status_online">Online</string>
<string name="activity_msg_chat_top_status_offline">Offline</string> <string name="activity_msg_chat_top_status_offline">Offline</string>
<string name="activity_msg_chat_list_card">[Card]</string>
</resources> </resources>