pk倒计时修复

This commit is contained in:
18401019693 2023-01-09 10:56:49 +08:00
parent 13146595bf
commit eaae58db31

View File

@ -39,7 +39,6 @@ import com.tencent.trtc.TRTCCloud;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.event.AnchorInfoEvent; import com.yunbao.common.event.AnchorInfoEvent;
import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.HttpClient;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
@ -306,6 +305,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
int i = 0; int i = 0;
private void nextPkTimeCountDown() { private void nextPkTimeCountDown() {
Log.i("vvvs", "mHandler:" + (mHandler != null) );
if (mHandler != null) { if (mHandler != null) {
mHandler.sendEmptyMessageAtTime(WHAT_PK_TIME, getNextSecondTime()); mHandler.sendEmptyMessageAtTime(WHAT_PK_TIME, getNextSecondTime());
} }
@ -384,11 +384,13 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
* pk时间倒计时 * pk时间倒计时
*/ */
private void changePkTime() { private void changePkTime() {
if (mPkTimeCount<0)return;
mPkTimeCount--; mPkTimeCount--;
Log.i("vvvs", "mPkTimeCount:" + mPkTimeCount);
if (mPkTimeCount >= 0) {// if (mPkTimeCount >= 0) {//
nextPkTimeCountDown(); nextPkTimeCountDown();
if (mContext instanceof LiveAudienceActivity) { if (mContext instanceof LiveAudienceActivity) {
((LiveAudienceActivity)mContext).setPkStatus(true); ((LiveAudienceActivity) mContext).setPkStatus(true);
} }
} else { } else {
if (mIsPkEnd) { if (mIsPkEnd) {
@ -397,7 +399,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
((LiveRyAnchorActivity) mContext).setPkBtnVisible(true); ((LiveRyAnchorActivity) mContext).setPkBtnVisible(true);
} }
if (mContext instanceof LiveAudienceActivity) { if (mContext instanceof LiveAudienceActivity) {
((LiveAudienceActivity)mContext).setPkStatus(false); ((LiveAudienceActivity) mContext).setPkStatus(false);
} }
//如果PK结束Im没有发送关闭PK的消息倒计时结束自动关闭 //如果PK结束Im没有发送关闭PK的消息倒计时结束自动关闭
// if (mLiveLinkMicPkViewHolder != null) { // if (mLiveLinkMicPkViewHolder != null) {
@ -616,7 +618,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
* 主播与主播PK PK主播发过来的已经接受 * 主播与主播PK PK主播发过来的已经接受
*/ */
public void onLinkMicToPk(UserBean u) { public void onLinkMicToPk(UserBean u) {
EventBus.getDefault().post(new AnchorInfoEvent(false,u.getId(), u.getUserNiceName(),u.getAvatar())); EventBus.getDefault().post(new AnchorInfoEvent(false, u.getId(), u.getUserNiceName(), u.getAvatar()));
Log.e("eve", u.getId() + ""); Log.e("eve", u.getId() + "");
/** /**
* 加入副房间 * 加入副房间
@ -718,7 +720,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
} }
}); });
LivePushRyViewHolder.btn_close.setVisibility(View.VISIBLE); LivePushRyViewHolder.btn_close.setVisibility(View.VISIBLE);
LiveRyAnchorActivity.isDRPK=1; LiveRyAnchorActivity.isDRPK = 1;
ScreenDimenUtil util = ScreenDimenUtil.getInstance(); ScreenDimenUtil util = ScreenDimenUtil.getInstance();
int mScreenWdith = util.getScreenWdith(); int mScreenWdith = util.getScreenWdith();
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mScreenWdith * 720 / 960); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mScreenWdith * 720 / 960);
@ -772,14 +774,14 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
LivePushRyViewHolder.mPreView1.setLayoutParams(params); LivePushRyViewHolder.mPreView1.setLayoutParams(params);
LivePushRyViewHolder.mPreView1.setVisibility(View.VISIBLE); LivePushRyViewHolder.mPreView1.setVisibility(View.VISIBLE);
LivePushRyViewHolder.btn_close.setVisibility(View.VISIBLE); LivePushRyViewHolder.btn_close.setVisibility(View.VISIBLE);
LiveRyAnchorActivity.isDRPK=1; LiveRyAnchorActivity.isDRPK = 1;
JSONObject msg1 = new JSONObject(); JSONObject msg1 = new JSONObject();
msg1.put("uid", CommonAppConfig.getInstance().getUid()); msg1.put("uid", CommonAppConfig.getInstance().getUid());
msg1.put("pkuid", CommonAppConfig.getInstance().getUid()); msg1.put("pkuid", CommonAppConfig.getInstance().getUid());
msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatarThumb()); msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatarThumb());
msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()); msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
EventBus.getDefault().post(new AnchorInfoEvent(false,bean.getId(), bean.getUserNiceName(),bean.getAvatar())); EventBus.getDefault().post(new AnchorInfoEvent(false, bean.getId(), bean.getUserNiceName(), bean.getAvatar()));
if (bean != null && bean.isRandomPk()) { if (bean != null && bean.isRandomPk()) {
msg1.put("random_pk", bean.isRandomPk() ? 1 : 0); msg1.put("random_pk", bean.isRandomPk() ? 1 : 0);
@ -1069,7 +1071,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
*/ */
public static void leaveDRRoom() { public static void leaveDRRoom() {
//清理PK上面对方的头像 //清理PK上面对方的头像
EventBus.getDefault().post(new AnchorInfoEvent(true,"", "","")); EventBus.getDefault().post(new AnchorInfoEvent(true, "", "", ""));
Log.e("ry", "退出多人OKKK" + inputStreamList.size()); Log.e("ry", "退出多人OKKK" + inputStreamList.size());
isDRPK = 0; isDRPK = 0;
@ -2161,7 +2163,6 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
if (mHandler != null) { if (mHandler != null) {
mHandler.removeCallbacksAndMessages(null); mHandler.removeCallbacksAndMessages(null);
} }
mHandler = null;
mSocketRyClient = null; mSocketRyClient = null;
if (mLiveLinkMicPkViewHolder != null) { if (mLiveLinkMicPkViewHolder != null) {
mLiveLinkMicPkViewHolder.release(); mLiveLinkMicPkViewHolder.release();