From ecca0ca854312d7dfcbb52a139a145ffb368e3b6 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Tue, 6 Sep 2022 17:07:43 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E7=9B=B4=E6=92=AD?= =?UTF-8?q?=E9=97=B4=E6=9D=A5=E6=B6=88=E6=81=AF=E6=98=BE=E7=A4=BA=E6=8C=87?= =?UTF-8?q?=E5=AF=BC=E5=91=98=E7=9A=84=E5=A4=B4=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/live/views/LiveRoomViewHolder.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 2b063007d..b1f954f88 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -1799,10 +1799,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis @Override public void onSuccess(List conversations) { if (conversations != null && !conversations.isEmpty()) { - Conversation conversation = conversations.get(0); - UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(conversation.getTargetId()); - if (userInfo != null) { - ImgLoader.display(mContext, userInfo.getPortraitUri().toString(), msgUserIcon); + for (Conversation conversation : conversations) { + if(conversation.getUnreadMessageCount()!=0){ + UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(conversation.getTargetId()); + if (userInfo != null) { + ImgLoader.display(mContext, userInfo.getPortraitUri().toString(), msgUserIcon); + } + break; + } + } } } From 5d7370e5dcaf7f5a67ff8f230e608903ea7c7c2b Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Tue, 6 Sep 2022 17:45:59 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E6=8C=87=E5=AF=BC=E5=91=98=E5=8F=AF=E4=BB=A5=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E5=A4=B4=E5=83=8F=E8=BF=9B=E4=B8=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manager/imrongcloud/MessageIMManager.java | 2 +- .../activity/PDLiveConversationActivity.java | 7 ++++--- .../res/layout/rc_conversationlist_item.xml | 16 ++++++++-------- .../PDLiveCustomConversationProvider.java | 19 +++++++++++++++++++ 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/manager/imrongcloud/MessageIMManager.java b/common/src/main/java/com/yunbao/common/manager/imrongcloud/MessageIMManager.java index 37bae9b8b..c5ff92f16 100644 --- a/common/src/main/java/com/yunbao/common/manager/imrongcloud/MessageIMManager.java +++ b/common/src/main/java/com/yunbao/common/manager/imrongcloud/MessageIMManager.java @@ -200,7 +200,7 @@ public class MessageIMManager { if (!TextUtils.isEmpty(userInfo.getExtra())) { IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class); long userId = IMLoginManager.get(context).getUserInfo().getId(); - if (!TextUtils.equals(model.getIsAdmin(), "1") && userId != model.getId()) { + if (userId != model.getId()) { RouteUtil.forwardUserHome(mContext, userInfo.getUserId(), 0); } else if (userId == model.getId()) { RouteUtil.forwardUserHome(mContext, userInfo.getUserId(), 2); diff --git a/live/src/main/java/com/yunbao/live/activity/PDLiveConversationActivity.java b/live/src/main/java/com/yunbao/live/activity/PDLiveConversationActivity.java index 7d1e5a2a8..dafc26dd2 100644 --- a/live/src/main/java/com/yunbao/live/activity/PDLiveConversationActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/PDLiveConversationActivity.java @@ -95,9 +95,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl private void initData() { targetId = getIntent().getStringExtra("targetId"); NoviceInstructorModel model = NoviceInstructorManager.get(this).getNoviceInstructor(); - if (model != null && !TextUtils.isEmpty(model.getMsgZdySendText())) { - inputPanel.setPresetInformation(model.getMsgZdySendText()); - } + //绑定聊天用户id inputPanel.setTargetId(targetId); //获取用户信息 @@ -108,6 +106,9 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl SearchUserBean userBean = GsonUtils.fromJson(userInfo.getExtra(), SearchUserBean.class); //新手指导员 if (!TextUtils.isEmpty(userBean.getIs_admin()) && TextUtils.equals(userBean.getIs_admin(), "1")) { + if (model != null && !TextUtils.isEmpty(model.getMsgZdySendText())) { + inputPanel.setPresetInformation(model.getMsgZdySendText()); + } isAdmin = true; imgMore.setVisibility(View.GONE); AdjustEvent adjustEvent1 = new AdjustEvent("exlgn3"); diff --git a/live/src/main/res/layout/rc_conversationlist_item.xml b/live/src/main/res/layout/rc_conversationlist_item.xml index 331e14de7..3deeab58a 100644 --- a/live/src/main/res/layout/rc_conversationlist_item.xml +++ b/live/src/main/res/layout/rc_conversationlist_item.xml @@ -3,16 +3,16 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/rc_conversation_item" android:layout_width="match_parent" - android:layout_height="123dp"> + android:layout_height="143dp"> + android:visibility="visible"> + android:layout_height="77dp" + android:visibility="gone"> @@ -237,7 +237,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentEnd="true" - android:layout_marginTop="41dp" + android:layout_marginTop="11dp" android:layout_marginEnd="@dimen/rc_margin_size_12" android:text="3 月 22 日" android:textColor="@color/rc_auxiliary_color" diff --git a/main/src/main/java/com/yunbao/main/utils/PDLiveCustomConversationProvider.java b/main/src/main/java/com/yunbao/main/utils/PDLiveCustomConversationProvider.java index 6142d3e55..587d9a42f 100644 --- a/main/src/main/java/com/yunbao/main/utils/PDLiveCustomConversationProvider.java +++ b/main/src/main/java/com/yunbao/main/utils/PDLiveCustomConversationProvider.java @@ -5,10 +5,15 @@ import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; +import android.widget.RelativeLayout; + +import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import com.google.gson.Gson; import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.RouteUtil; import com.yunbao.main.R; import java.util.List; @@ -56,6 +61,16 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider { IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class); //指导员对话逻辑 if (model != null && TextUtils.equals(model.getIsAdmin(), "1")) { + RelativeLayout conversationItem = holder.getView(R.id.rc_conversation_item); + RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) conversationItem.getLayoutParams(); + params.height = DpUtil.dp2px(143); + conversationItem.setLayoutParams(params); + holder.setOnClickListener(R.id.img_administrator, new View.OnClickListener() { + @Override + public void onClick(View v) { + RouteUtil.forwardUserHome(holder.getContext(), targetId, 0); + } + }); holder.setBackgroundRes(R.id.administrator_layout, R.mipmap.img_news_instructor_bg); holder.setBackgroundRes(R.id.rc_conversation_item, R.mipmap.white_bg); holder.setVisible(R.id.rc_conversation_portrait_layout, false); @@ -75,6 +90,10 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider { holder.setText(R.id.conversation_date, RongDateUtils.getConversationListFormatDate(uiConversation.mCore.getSentTime(), holder.getContext())); } else { + View conversationItem = holder.getConvertView(); + RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) conversationItem.getLayoutParams(); + params.height = DpUtil.dp2px(72); + conversationItem.setLayoutParams(params); //非指导员按照原有视图展示 holder.setVisible(R.id.rc_conversation_portrait_layout, true); holder.setVisible(R.id.administrator_layout, false); From deb35bf5fec2693d8eb6dee19fea8077319da2a2 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Tue, 6 Sep 2022 17:46:50 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=E7=82=B9=E5=87=BB=E7=A7=81=E4=BF=A1?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E4=BD=86=E6=9C=AA=E8=AF=BB=E5=90=8E=E4=BC=9A?= =?UTF-8?q?=E6=81=A2=E5=A4=8D=E9=BB=98=E8=AE=A4=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/live/activity/PDLIiveChatActivity.java | 1 + .../com/yunbao/live/views/LiveRoomViewHolder.java | 11 +++-------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java b/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java index 348f1033d..a57ef0f4d 100644 --- a/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java @@ -195,6 +195,7 @@ public class PDLIiveChatActivity extends FragmentActivity { @Override protected void onDestroy() { super.onDestroy(); + EventBus.getDefault().post(new io.rong.imlib.model.Message()); Bus.getOff(this); } diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index b1f954f88..2bcbc5c57 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -1009,7 +1009,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis @Override public void onResume() { super.onResume(); - changeMsgView(msg2, msg); reloadIM(); } @@ -1704,11 +1703,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } else if (i == R.id.user_guard) { // ((LiveActivity) mContext).openUserMoreListWindow(2, true); ((LiveActivity) mContext).openNewGuardListWindow(); - } else if (i == R.id.room_msg) { - changeMsgView(msg, msg2); - } else if (i == R.id.room_msg_user) { - changeMsgView(msg2, msg); - } else if (i == R.id.lt_trickery) { + } if (i == R.id.lt_trickery) { showTrickeryDialog(); } @@ -1805,11 +1800,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis if (userInfo != null) { ImgLoader.display(mContext, userInfo.getPortraitUri().toString(), msgUserIcon); } - break; + return; } - } } + changeMsgView(msg2,msg); } @Override