From c633836e1203e7cfe66162a77e9a10d945c86937 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Fri, 26 Aug 2022 16:09:15 +0800 Subject: [PATCH] =?UTF-8?q?update:=E4=BF=AE=E6=94=B9=E5=AE=88=E6=8A=A4icon?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/live/views/LiveRoomViewHolder.java | 22 ++++++++++++++++++- .../live/views/PortraitLiveManager.java | 9 +++++--- 2 files changed, 27 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 56e60553f..95d865260 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -251,6 +251,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private RecyclerView fastMsgRecyclerView; private LiveRoomFastMessageRecyclerViewAdapter fastMessageRecyclerViewAdapter; + private LiveUserGiftBean nowGuardUser; + public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) { super(context, parentView); Contexts = context; @@ -1413,6 +1415,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private void setGuardIcon(LiveUserGiftBean guard) { if (guard != null) { + nowGuardUser=guard; ImgLoader.displayAvatar(mContext, guard.getAvatar(), userGuard); gift_svga.setVisibility(View.VISIBLE); } @@ -1663,7 +1666,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void refreshUserList(JSONObject obj) { List list = JSON.parseArray(obj.getString("userlist"), LiveUserGiftBean.class); mLiveUserAdapter.refreshList(list); - getGuardInfo(); } /** @@ -1772,6 +1774,24 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mLiveEnterRoomAnimPresenter.enterRoom(bean); } room_hot.setText(formatBigNum.formatBigNum(bean.getLiveChatBean().getHot_num())); + LiveUserGiftBean chatBean = bean.getUserBean(); + if(chatBean!=null&&nowGuardUser!=null) { + LiveUserGiftBean tmp = null; + if (chatBean.getGuardType() != 0 && chatBean.getGuardType() > nowGuardUser.getGuardType()) { + tmp = chatBean; + } else if (chatBean.getGuardType() != 0 && chatBean.getGuardType() == nowGuardUser.getGuardType() && chatBean.getLevel() > nowGuardUser.getLevel()) { + tmp = chatBean; + } + setGuardIcon(tmp); + } + } + + /** + * 用户离开房间 + * @param bean 用户 + */ + public void onExitRoom(UserBean bean){ + // getGuardInfo(); } /** diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 79905adfb..21e3d84c5 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -426,9 +426,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveLinkMicPresenter.onAudienceLeaveRoom(bean); } try { - if (mLiveRoomViewHolder.room_hot != null) { - if (!"".equals(bean.getHot_num()) && !"0".equals(bean.getHot_num())) { - mLiveRoomViewHolder.room_hot.setText(formatBigNum.formatBigNum(bean.getHot_num())); + if(mLiveRoomViewHolder!=null){ + mLiveRoomViewHolder.onExitRoom(bean); + if (mLiveRoomViewHolder.room_hot != null) { + if (!"".equals(bean.getHot_num()) && !"0".equals(bean.getHot_num())) { + mLiveRoomViewHolder.room_hot.setText(formatBigNum.formatBigNum(bean.getHot_num())); + } } } } catch (Exception ignored) {