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 325083709..56003c782 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -79,7 +79,6 @@ import com.yunbao.common.bean.RewardAllModel; import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.TaskModel; import com.yunbao.common.bean.UserBean; -import com.yunbao.common.event.CoinChangeEvent; import com.yunbao.common.event.CustomFullServiceNotifyEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.API; @@ -2060,28 +2059,21 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis //左上角显示对方主播头像及昵称 public void setOtherInfo(String touids, String url, String name) { - Handler handler = new Handler(); - handler.postDelayed(new Runnable() { + if (!pkHandler) { + return; + } + goto_room_view.setVisibility(View.VISIBLE); + touid = touids; + pkUid = touids; + ImgLoader.displayAvatar(mContext, url, avatarOther); + tv_avatarOther_name.setText(name); + goto_room_view.setOnClickListener(new View.OnClickListener() { @Override - public void run() { - if (!pkHandler) { - return; - } - goto_room_view.setVisibility(View.VISIBLE); - touid = touids; - pkUid = touids; - ImgLoader.displayAvatar(mContext, url, avatarOther); - tv_avatarOther_name.setText(name); - goto_room_view.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - showUserDialog(touids); - } - }); - initPkRank(); + public void onClick(View view) { + showUserDialog(touids); } - }, 4000);//3秒后执行Runnable中的run方法 - + }); + initPkRank(); if (LivePushTxViewHolder.mTRTCCloud != null) { @@ -3814,7 +3806,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis updatePkRank((PkRankBean) event.getObject()); break; case PK_TWO_UPDATE_HEAD_DATA: - setHeadData( event.getLivePKUserListBean()); + setHeadData(event.getLivePKUserListBean()); break; case PK_TWO_START: pkUid = event.getObject().toString(); 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 a46b0cbed..0694f8dfd 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -500,7 +500,14 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class); if (mLiveRoomViewHolder != null) { mLiveRoomViewHolder.pkHandler = true; - mLiveRoomViewHolder.setOtherInfo(pkInfo.getString("pkuid"), pkInfo.getString("pkuimg"), pkInfo.getString("pkuname")); + linkMicPkStartRunnable = new Runnable() { + @Override + public void run() { + mLiveRoomViewHolder.setOtherInfo(pkInfo.getString("pkuid"), pkInfo.getString("pkuimg"), pkInfo.getString("pkuname")); + } + }; + linkMicPkStartHandler.postDelayed(linkMicPkStartRunnable,4000); + } mLiveRyLinkMicPkPresenter.onEnterRoomPkStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("pk_time"), livePKUserListBean); } else if (!pkInfo.getString("end_pk_time").equals("0")) { @@ -1222,19 +1229,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe private String mPkUid, mPkhead, mPkname, mIsLadders; private Handler linkMicPkStartHandler = new Handler(); - private Runnable linkMicPkStartRunnable = new Runnable() { - - @Override - public void run() { - if (mLiveRoomViewHolder != null) { - Log.e("tasdsdg", liveID + "1111" + CommonAppConfig.getInstance().getUid()); - if (!liveID.equals(CommonAppConfig.getInstance().getUid())) { - mLiveRoomViewHolder.setOtherInfo(mPkUid, mPkhead, mPkname); - mLiveRoomViewHolder.initPkRank(mIsLadders); - } - } - } - }; + private Runnable linkMicPkStartRunnable = null; @Override public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname, String isLadders) { @@ -1243,7 +1238,19 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mPkhead = pkhead; mPkname = pkname; mIsLadders = isLadders; + + linkMicPkStartRunnable = () -> { + if (mLiveRoomViewHolder != null) { + Log.e("tasdsdg", liveID + "1111" + CommonAppConfig.getInstance().getUid()); + if (!liveID.equals(CommonAppConfig.getInstance().getUid())) { + mLiveRoomViewHolder.setOtherInfo(mPkUid, mPkhead, mPkname); + mLiveRoomViewHolder.initPkRank(mIsLadders); + } + } + }; + if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.pkHandler = true; mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1); linkMicPkStartHandler.postDelayed(linkMicPkStartRunnable, 4000);//3秒后执行Runnable中的run方法 }