update:修改守护icon展示逻辑

This commit is contained in:
zlzw 2022-08-26 16:09:15 +08:00
parent 3b8f0466a0
commit c633836e12
2 changed files with 27 additions and 4 deletions

View File

@ -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<LiveUserGiftBean> 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();
}
/**

View File

@ -426,11 +426,14 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveLinkMicPresenter.onAudienceLeaveRoom(bean);
}
try {
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) {
}