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) {