私聊改造:完成对话框基础功能

This commit is contained in:
huangjian
2023-01-30 18:51:47 +08:00
parent e99a65c21e
commit 3379aeed02
14 changed files with 619 additions and 194 deletions

View File

@@ -2,6 +2,8 @@ package com.mango.moshen.ui.im;
import android.content.Context;
import com.mango.core.im.custom.bean.UserCardAttachment;
import com.mango.moshen.ui.im.chat.MsgViewHolderUserCard;
import com.netease.nim.uikit.api.NimUIKit;
import com.netease.nim.uikit.api.model.contact.ContactEventListener;
import com.netease.nim.uikit.api.model.session.SessionCustomization;
@@ -133,6 +135,7 @@ public class ImInitHelper {
NimUIKit.registerMsgItemViewHolder(NoticeAttachment.class, MsgViewHolderContent.class);
NimUIKit.registerMsgItemViewHolder(RedPacketAttachment.class, MsgViewHolderRedPacket.class);
NimUIKit.registerMsgItemViewHolder(NewbieHelloAttachment.class, MsgViewHolderHello.class);
NimUIKit.registerMsgItemViewHolder(UserCardAttachment.class, MsgViewHolderUserCard.class);
NimUIKit.registerMsgItemViewHolder(LotteryAttachment.class, MsgViewHolderLottery.class);
NimUIKit.registerMsgItemViewHolder(NobleAttachment.class, MsgViewHolderText.class);
NimUIKit.registerMsgItemViewHolder(CarAttachment.class, MsgViewHolderText.class);

View File

@@ -17,7 +17,9 @@ import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mango.core.im.custom.bean.UserCardAttachment;
import com.mango.core.room.event.MessageSizeEvent;
import com.mango.core.utils.CurrentTimeUtils;
import com.mango.xchat_android_library.utils.SingleToastUtil;
import com.netease.nim.uikit.R;
import com.netease.nim.uikit.api.NimUIKit;
@@ -85,8 +87,6 @@ public class MessageListPanelEx {
private static final int REQUEST_CODE_FORWARD_PERSON = 0x01;
private static final int REQUEST_CODE_FORWARD_TEAM = 0x02;
// 背景图片缓存
private static Pair<String, Bitmap> background;
private static final Comparator<IMMessage> comp = new Comparator<IMMessage>() {
@Override
@@ -95,26 +95,19 @@ public class MessageListPanelEx {
return time == 0 ? 0 : (time < 0 ? -1 : 1);
}
};
// container
private Container container;
// 背景图片缓存
private static Pair<String, Bitmap> background;
private final View rootView;
// message list view
private RecyclerView messageListView;
private List<IMMessage> items;
private MsgAdapter adapter;
private ImageView listviewBk;
// 新消息到达提醒
private IncomingMsgPrompt incomingMsgPrompt;
private Handler uiHandler;
// 仅显示消息记录,不接收和发送消息
private final boolean recordOnly;
// 从服务器拉取消息记录
private final boolean remote;
// 语音转文字
private VoiceTrans voiceTrans;
// 待转发消息
private IMMessage forwardMessage;
private CountDownTimer countDownTimer;
// container
private Container container;
// message list view
private RecyclerView messageListView;
private List<IMMessage> items;
private MsgAdapter adapter;
private final OnItemClickListener listener = new OnItemClickListener() {
@Override
public void onItemClick(IRecyclerView adapter, View view, int position) {
@@ -217,13 +210,17 @@ public class MessageListPanelEx {
deleteItem(message, false);
}
};
private ImageView listviewBk;
// 新消息到达提醒
private IncomingMsgPrompt incomingMsgPrompt;
private Handler uiHandler;
// 语音转文字
private VoiceTrans voiceTrans;
// 待转发消息
private IMMessage forwardMessage;
private UserInfoObserver uinfoObserver;
private OnMessageFilterListener onMessageFilterListener;
public MessageListPanelEx(Container container, View rootView, boolean recordOnly, boolean remote) {
this(container, rootView, null, recordOnly, remote);
}
public MessageListPanelEx(Container container, View rootView, IMMessage anchor, boolean recordOnly, boolean remote) {
this.container = container;
this.rootView = rootView;
@@ -243,16 +240,10 @@ public class MessageListPanelEx {
public void onDestroy() {
registerObservers(false);
if (countDownTimer != null) {
countDownTimer.cancel();
}
}
public boolean onBackPressed() {
uiHandler.removeCallbacks(null);
if (countDownTimer != null) {
countDownTimer.cancel();
}
MessageAudioControl.getInstance(container.activity).stopAudio(); // 界面返回,停止语音播放
if (voiceTrans != null && voiceTrans.isShow()) {
voiceTrans.hide();
@@ -730,12 +721,9 @@ public class MessageListPanelEx {
private class MessageLoader implements BaseFetchLoadAdapter.RequestLoadMoreListener, BaseFetchLoadAdapter.RequestFetchMoreListener {
private final int loadMsgCount = NimUIKitImpl.getOptions().messageCountLoadOnce;
private QueryDirectionEnum direction = null;
private final IMMessage anchor;
private final boolean remote;
private QueryDirectionEnum direction = null;
private boolean firstLoad = true;
private final RequestCallback<List<IMMessage>> callback = new RequestCallbackWrapper<List<IMMessage>>() {
@Override
@@ -875,6 +863,9 @@ public class MessageListPanelEx {
} else {
// 顶部加载
if (noMoreMessage) {
IMMessage imMessage = MessageBuilder.createCustomMessage(container.account, container.sessionType, new UserCardAttachment());
imMessage.setStatus(MsgStatusEnum.draft);
messages.add(0, imMessage);
adapter.fetchMoreEnd(messages, true);
} else {
adapter.fetchMoreComplete(messages);
@@ -1070,18 +1061,11 @@ public class MessageListPanelEx {
}
private boolean enableRevokeButton(IMMessage selectedItem) {
if (selectedItem.getStatus() == MsgStatusEnum.success
&& NimUIKitImpl.getMsgRevokeFilter() != null
&& !NimUIKitImpl.getMsgRevokeFilter().shouldIgnore(selectedItem)
&& !recordOnly) {
if (selectedItem.getDirect() == MsgDirectionEnum.Out) {
return true;
} else if (NimUIKit.getOptions().enableTeamManagerRevokeMsg && selectedItem.getSessionType() == SessionTypeEnum.Team) {
TeamMember member = NimUIKit.getTeamProvider().getTeamMember(selectedItem.getSessionId(), NimUIKit.getAccount());
return member != null && member.getType() == TeamMemberType.Owner || member.getType() == TeamMemberType.Manager;
}
}
return false;
return selectedItem.getStatus() == MsgStatusEnum.success
&& selectedItem.getMsgType() == MsgTypeEnum.text
&& !recordOnly
&& selectedItem.getDirect() == MsgDirectionEnum.Out
&& CurrentTimeUtils.getCurrentTime() - selectedItem.getTime() < 2 * 60 * 1000;
}
// 长按菜单项--重发

View File

@@ -52,6 +52,9 @@ public class AddBlackListActivity extends BaseMvpActivity<IAddBlackListView, Add
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_nim_add_black_list);
initWhiteTitleBar("聊天设置");
account = getIntent().getStringExtra(Extras.EXTRA_ACCOUNT);
if (TextUtils.isEmpty(account)) account = "0";
rlContent = findViewById(R.id.rl_content);
@@ -62,15 +65,13 @@ public class AddBlackListActivity extends BaseMvpActivity<IAddBlackListView, Add
tvAddBlackList.setOnClickListener(this);
findViewById(R.id.tv_report).setOnClickListener(this);
List<String> blackListAccount = NimFriendModel.get().getMyBlackListAccount();
if (blackListAccount != null)
changeText(blackListAccount.contains(account));
if (blackListAccount != null) changeText(blackListAccount.contains(account));
initTarget();
}
void changeText(boolean contains) {
tvAddBlackList.setText(contains ? "移除黑名单" : "加入黑名单");
initWhiteTitleBar(contains ? "移除黑名单" : "加入黑名单");
}
/**

View File

@@ -295,6 +295,7 @@ public class NimP2PMessageActivity extends NewBaseMessageActivity {
tvAddBlackTip.setVisibility(contains ? View.VISIBLE : View.GONE);
}
/*
if (!SystemUidUtil.isSystemUid(sessionId)) {
View clUserDetails = findViewById(R.id.cl_user_details);
UserModel.get().getUserInfoDetail(Long.parseLong(sessionId))
@@ -330,6 +331,7 @@ public class NimP2PMessageActivity extends NewBaseMessageActivity {
}
});
}
*/
}
private void registerObservers(boolean register) {

View File

@@ -0,0 +1,217 @@
package com.mango.moshen.ui.im.chat;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mango.core.user.UserModel;
import com.mango.core.user.bean.UserPhoto;
import com.mango.core.utils.StarUtils;
import com.mango.core.utils.StringExtensionKt;
import com.mango.core.utils.net.RxHelper;
import com.mango.moshen.R;
import com.mango.moshen.common.widget.CircleImageView;
import com.mango.moshen.skill.activity.SkillHomeActivity;
import com.mango.moshen.skill.repository.SkillModel;
import com.mango.moshen.ui.user.ShowPhotoActivity;
import com.mango.moshen.ui.user.UserInfoActivity;
import com.mango.moshen.ui.utils.ImageLoadUtils;
import com.mango.xchat_android_library.utils.JavaUtil;
import com.mango.xchat_android_library.utils.ListUtils;
import com.netease.nim.uikit.business.session.viewholder.MsgViewHolderBase;
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Created by chenran on 2018/1/2.
*/
public class MsgViewHolderUserCard extends MsgViewHolderBase {
private BaseQuickAdapter<UserPhoto, BaseViewHolder> photoAdapter;
private LinearLayout llSkill;
private ImageView ivSkill0;
private ImageView ivSkill1;
private ImageView ivSkill2;
private View flSkill1;
private View flSkill2;
private CircleImageView ivAvatar;
private TextView tvNick;
private ImageView ivGender;
private TextView tvConstellation;
private TextView tvDesc;
private RecyclerView rvPhotos;
public MsgViewHolderUserCard(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected int getContentResId() {
return R.layout.layout_p2p_user_card;
}
@Override
protected void inflateContentView() {
llSkill = findViewById(R.id.ll_skill);
ivSkill0 = findViewById(R.id.iv_skill_0);
ivSkill1 = findViewById(R.id.iv_skill_1);
ivSkill2 = findViewById(R.id.iv_skill_2);
flSkill1 = findViewById(R.id.fl_skill_1);
flSkill2 = findViewById(R.id.fl_skill_2);
ivAvatar = findViewById(R.id.iv_avatar);
tvNick = findViewById(R.id.tv_nick);
ivGender = findViewById(R.id.iv_gender);
tvConstellation = findViewById(R.id.tv_constellation);
tvDesc = findViewById(R.id.tv_desc);
rvPhotos = findViewById(R.id.rv_photos);
if (photoAdapter == null) {
photoAdapter = new BaseQuickAdapter<UserPhoto, BaseViewHolder>(R.layout.item_p2p_user_photo) {
@Override
protected void convert(@NonNull BaseViewHolder helper, UserPhoto item) {
ImageLoadUtils.loadRectImage(
context,
item.getPhotoUrl(),
(ImageView) helper.itemView,
R.drawable.default_cover,
ScreenUtil.dip2px(8)
);
helper.itemView.setOnClickListener(v -> showUserPhoto(helper.getAdapterPosition()));
}
};
rvPhotos.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false));
rvPhotos.setAdapter(photoAdapter);
loadData();
}
}
private void showUserPhoto(int position) {
//创建一个集合拿来做用户所有照片信息
ArrayList<UserPhoto> userPhotos = new ArrayList<>();
List<UserPhoto> realmList = photoAdapter.getData();
for (UserPhoto photo : realmList) {
UserPhoto newPhoto = new UserPhoto();
newPhoto.setPid(photo.getPid());
newPhoto.setPhotoUrl(photo.getPhotoUrl());
userPhotos.add(newPhoto);
}
Intent intent = new Intent(context, ShowPhotoActivity.class);
intent.putExtra("position", position);
intent.putExtra("photoList", userPhotos);
context.startActivity(intent);
}
@SuppressLint("CheckResult")
private void loadData() {
long uid = JavaUtil.str2long(message.getSessionId());
ivAvatar.setOnClickListener(v -> UserInfoActivity.Companion.start(context, uid));
UserModel.get().getUserInfo(uid)
.compose(RxHelper.bindContext(context))
.subscribe(userInfo -> {
ImageLoadUtils.loadAvatar(userInfo.getAvatar(), ivAvatar);
tvNick.setText(StringExtensionKt.subAndReplaceDot(userInfo.getNick(), 7));
ivGender.setImageResource(userInfo.getGender() == 1 ? R.drawable.ic_gender_male : R.drawable.ic_gender_female);
tvDesc.setText(userInfo.getUserDesc() != null ? userInfo.getUserDesc() : context.getResources().getString(R.string.msg_no_user_desc));
//设置星座
String star = StarUtils.getConstellation(new Date(userInfo.getBirth()));
if (null == star) {
tvConstellation.setVisibility(View.GONE);
} else {
tvConstellation.setText(star);
tvConstellation.setVisibility(View.VISIBLE);
}
photoAdapter.setNewData(userInfo.getPrivatePhoto());
});
SkillModel.Companion
.getInstance()
.getUserAllSkillCardDetail(uid)
.compose(RxHelper.bindContext(context))
.subscribe(entities -> {
if (ListUtils.isListEmpty(entities)) {
llSkill.setVisibility(View.GONE);
} else {
llSkill.setVisibility(View.VISIBLE);
llSkill.setOnClickListener(v ->
SkillHomeActivity.Companion.start(
context,
SkillHomeActivity.PAGE_TYPE_CUSTOM,
uid
)
);
ImageLoadUtils.loadImage(context, entities.get(0).getIcon(), ivSkill0);
if (entities.size() == 1) return;
ImageLoadUtils.loadImage(context, entities.get(1).getIcon(), ivSkill1);
flSkill1.setVisibility(View.VISIBLE);
if (entities.size() == 2) return;
ImageLoadUtils.loadImage(context, entities.get(2).getIcon(), ivSkill2);
flSkill2.setVisibility(View.VISIBLE);
}
});
}
@Override
protected void bindContentView() {
}
// 内容区域点击事件响应处理。
protected void onItemClick() {
}
// 内容区域长按事件响应处理。该接口的优先级比adapter中有长按事件的处理监听高当该接口返回为true时adapter的长按事件监听不会被调用到。
protected boolean onItemLongClick() {
return true;
}
// 当是接收到的消息时内容区域背景的drawable id
protected int leftBackground() {
return 0;
}
// 当是发送出去的消息时内容区域背景的drawable id
protected int rightBackground() {
return 0;
}
// 返回该消息是不是居中显示
protected boolean isMiddleItem() {
return true;
}
// 是否显示头像,默认为显示
protected boolean isShowHeadImage() {
return false;
}
// 是否显示气泡背景,默认为显示
protected boolean isShowBubble() {
return false;
}
// 是否显示已读,默认为显示
protected boolean shouldDisplayReceipt() {
return false;
}
}

View File

@@ -427,30 +427,6 @@ public class RecentContactsFragment extends TFragment {
refreshMessages(false);
}
});
alertDialog.addItem("删除该聊天(仅服务器)", new onSeparateItemClickListener() {
@Override
public void onClick() {
NIMClient.getService(MsgService.class)
.deleteRoamingRecentContact(recent.getContactId(), recent.getSessionType())
.setCallback(new RequestCallback<Void>() {
@Override
public void onSuccess(Void param) {
SingleToastUtil.showToastShort("delete success");
}
@Override
public void onFailed(int code) {
SingleToastUtil.showToastShort("delete failed, code:" + code);
}
@Override
public void onException(Throwable exception) {
}
});
}
});
alertDialog.show();
}

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#8AD4FF"
android:endColor="#45BBFF" />
<corners android:radius="30dp" />
</shape>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"
android:useLevel="false">
<solid android:color="#F8F8FD" />
</shape>

View File

@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_normal_1c1b22"
android:background="@color/white"
android:orientation="vertical">
<com.mango.moshen.base.TitleBar
@@ -13,70 +13,122 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_30" />
<RelativeLayout
android:id="@+id/rl_content"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@color/bg_secondary_2a2a39">
android:layout_height="match_parent"
android:background="@color/bg_normal_1c1b22">
<ImageView
android:id="@+id/iv_avatar"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
tools:background="@drawable/default_avatar" />
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@id/iv_avatar"
android:textColor="@color/text_title_white"
android:textSize="15dp"
tools:text="单刀也学士" />
android:layout_marginStart="15dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="15dp"
android:background="@drawable/shape_white_8dp_round"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:gravity="center"
android:text="个人主页 >"
android:textColor="@color/text_secondary_4f516a"
android:textSize="14dp" />
<RelativeLayout
android:id="@+id/rl_content"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginTop="10dp">
</RelativeLayout>
<ImageView
android:id="@+id/iv_avatar"
android:layout_width="44dp"
android:layout_height="44dp"
android:layout_centerVertical="true"
android:layout_marginStart="10dp"
tools:background="@drawable/default_avatar" />
<TextView
android:id="@+id/tv_report"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginTop="@dimen/dp_20"
android:background="@color/bg_secondary_2a2a39"
android:gravity="center"
android:text="举报"
android:textColor="@color/text_title_white"
android:textSize="16dp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginTop="8dp"
android:layout_toRightOf="@id/iv_avatar"
android:textColor="@color/text_title_white"
android:textSize="16sp"
android:textStyle="bold"
tools:text="单刀也学士" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/line_353548" />
<TextView
android:id="@+id/tv_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tv_name"
android:layout_alignStart="@id/tv_name"
android:layout_marginTop="5dp"
android:text="ID:953842"
android:textColor="#ffbabbcd"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_add_black_list"
android:layout_width="match_parent"
android:layout_height="44dp"
android:background="@color/bg_secondary_2a2a39"
android:gravity="center"
android:text="加入黑名单"
android:textColor="@color/text_title_white"
android:textSize="16dp"
android:textStyle="bold" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:gravity="center"
android:src="@drawable/arrow_right" />
</RelativeLayout>
<TextView
android:id="@+id/tv_add_top"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginTop="10dp"
android:background="@color/bg_secondary_2a2a39"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:text="置顶聊天"
android:textColor="@color/text_title_white"
android:textSize="14sp" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:background="@color/line_353548" />
<TextView
android:id="@+id/tv_add_black_list"
android:layout_width="match_parent"
android:layout_height="44dp"
android:background="@color/bg_secondary_2a2a39"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:text="加入黑名单"
android:textColor="@color/text_title_white"
android:textSize="14sp" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:background="@color/line_353548" />
<TextView
android:id="@+id/tv_report"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginBottom="10dp"
android:background="@color/bg_secondary_2a2a39"
android:drawableEnd="@drawable/arrow_right"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="举报"
android:textColor="@color/text_title_white"
android:textSize="14sp" />
</LinearLayout>
</FrameLayout>
</LinearLayout>

View File

@@ -127,71 +127,6 @@
android:src="@mipmap/common_ic_close_red" />
</RelativeLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_user_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="8dp"
android:background="@drawable/bg_p2p_top_userinfo"
android:visibility="gone">
<com.mango.moshen.common.widget.CircleImageView
android:id="@+id/iv_avatar"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:src="@drawable/default_avatar"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_nick"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:textColor="@color/color_333333"
android:textSize="16dp"
app:layout_constraintBottom_toTopOf="@id/tv_content"
app:layout_constraintStart_toEndOf="@id/iv_avatar"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="这就是大哥呀呀" />
<TextView
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:textColor="@color/color_666666"
android:textSize="14dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@id/tv_nick"
app:layout_constraintTop_toBottomOf="@id/tv_nick"
tools:text="正在“可惜不是你…”热聊中" />
<com.mango.xchat_android_library.widget.DrawableCenterTextView
android:id="@+id/tv_go_room"
android:layout_width="82dp"
android:layout_height="26dp"
android:layout_marginEnd="7dp"
android:layout_marginBottom="20dp"
android:background="@drawable/bg_p2p_top_userinfo_btn"
android:drawableStart="@drawable/ic_living_1"
android:drawablePadding="4dp"
android:gravity="center"
android:text="跟随进房"
android:textColor="@color/white"
android:textSize="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.fragment.app.FragmentContainerView
android:id="@+id/message_fragment_container"
android:layout_width="match_parent"

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/iv_pic"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp" />

View File

@@ -0,0 +1,201 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="1px"
android:contentDescription="这是有用的,请不要删除"
android:lines="1"
android:text="--------------------------------------------------------------------------------------------------------------------------------------------------------------------------"
android:textColor="@color/white"
android:textSize="12sp"
android:visibility="invisible" />
<LinearLayout
android:id="@+id/ll_skill"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginStart="15dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="15dp"
android:background="@drawable/shape_white_8dp_round"
android:baselineAligned="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:text="技能卡"
android:textColor="#ff171a58"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" · TA会这些技能"
android:textColor="#8A8CAB"
android:textSize="10sp" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<FrameLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:background="@drawable/shape_circle_f8f8fd">
<ImageView
android:id="@+id/iv_skill_0"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:src="@drawable/default_avatar" />
</FrameLayout>
<FrameLayout
android:id="@+id/fl_skill_1"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginStart="-12dp"
android:background="@drawable/shape_circle_f8f8fd"
android:visibility="gone"
tools:visibility="visible">
<ImageView
android:id="@+id/iv_skill_1"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:src="@drawable/default_avatar" />
</FrameLayout>
<FrameLayout
android:id="@+id/fl_skill_2"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginStart="-12dp"
android:background="@drawable/shape_circle_f8f8fd"
android:visibility="gone"
tools:visibility="visible">
<ImageView
android:id="@+id/iv_skill_2"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:src="@drawable/default_avatar" />
</FrameLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="20dp"
android:src="@drawable/arrow_right_3" />
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="8dp"
android:background="@drawable/shape_white_8dp_round">
<com.mango.moshen.common.widget.CircleImageView
android:id="@+id/iv_avatar"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
android:src="@drawable/default_avatar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_nick"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:textColor="@color/color_333333"
android:textSize="16dp"
app:layout_constraintBottom_toTopOf="@id/tv_desc"
app:layout_constraintStart_toEndOf="@id/iv_avatar"
app:layout_constraintTop_toTopOf="@id/iv_avatar"
app:layout_constraintVertical_chainStyle="packed"
tools:text="这就是大哥呀呀" />
<ImageView
android:id="@+id/iv_gender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
app:layout_constraintBottom_toBottomOf="@id/tv_nick"
app:layout_constraintStart_toEndOf="@id/tv_nick"
app:layout_constraintTop_toTopOf="@id/tv_nick"
tools:src="@drawable/ic_gender_female" />
<TextView
android:id="@+id/tv_constellation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:background="@drawable/shape_8ad4ff_to_45bbff"
android:includeFontPadding="false"
android:paddingStart="6dp"
android:paddingTop="2dp"
android:paddingEnd="6dp"
android:paddingBottom="2dp"
android:textColor="@color/white"
android:textSize="10sp"
app:layout_constraintBottom_toBottomOf="@id/tv_nick"
app:layout_constraintStart_toEndOf="@id/iv_gender"
app:layout_constraintTop_toTopOf="@id/tv_nick"
tools:text="处女座" />
<TextView
android:id="@+id/tv_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:textColor="#BABBCD"
android:textSize="14dp"
app:layout_constraintBottom_toBottomOf="@id/iv_avatar"
app:layout_constraintStart_toStartOf="@id/tv_nick"
app:layout_constraintTop_toBottomOf="@id/tv_nick"
tools:text="正在“可惜不是你…”热聊中" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_photos"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginBottom="16dp"
android:clipToPadding="false"
android:paddingStart="8dp"
android:paddingEnd="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_avatar" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>

View File

@@ -0,0 +1,31 @@
package com.mango.core.im.custom.bean;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.mango.core.newbie.NewbieHelloInfo;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class UserCardAttachment extends CustomAttachment {
private long uid;
public UserCardAttachment() {
super(0, 0);
}
@Override
protected void parseData(JSONObject data) {
uid = data.getLongValue("uid");
}
@Override
protected JSONObject packData() {
return null;
}
}

View File

@@ -30,7 +30,7 @@
android:layout_below="@id/message_item_time"
android:layout_marginEnd="11dp"
android:visibility="gone"
tools:visibility="visible" />
/>
<com.netease.nim.uikit.common.ui.imageview.HeadImageView
android:id="@+id/message_item_portrait_right"