多人Pk问题

This commit is contained in:
18401019693 2023-12-15 14:03:42 +08:00
parent bd9c8c2265
commit 302b789970
3 changed files with 26 additions and 17 deletions

View File

@ -1,6 +1,5 @@
package com.yunbao.live.presenter; package com.yunbao.live.presenter;
import static com.blankj.utilcode.util.SnackbarUtils.dismiss;
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread; import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK; import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK;
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK; import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
@ -38,7 +37,6 @@ import android.widget.TextView;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.ViewUtils;
import com.tencent.trtc.TRTCCloud; import com.tencent.trtc.TRTCCloud;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveInfoModel;
@ -2500,11 +2498,11 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
* 更新Pk分数 * 更新Pk分数
*/ */
public void upDataPkScore(JSONArray pkScores, String uid, int time) { public void upDataPkScore(JSONArray pkScores, String uid, int time) {
String userID1 = (String) imageGrade1.getTag(); String userID1 = (String) imageGrade1.getTag();
String userID2 = (String) imageGrade2.getTag(); String userID2 = (String) imageGrade2.getTag();
String userID4 = (String) imageGrade4.getTag(); String userID4 = (String) imageGrade4.getTag();
if (livePushRyViewHolder.timeTitle.getVisibility() == View.GONE) { if (livePushRyViewHolder.timeTitle.getVisibility() == View.GONE) {
mHandler.removeMessages(WHAT_PK_TIME2);
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) livePushRyViewHolder.timeTitle.getLayoutParams(); RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) livePushRyViewHolder.timeTitle.getLayoutParams();
layoutParams.topMargin = DpUtil.dp2px(123); layoutParams.topMargin = DpUtil.dp2px(123);
livePushRyViewHolder.timeTitle.setLayoutParams(layoutParams); livePushRyViewHolder.timeTitle.setLayoutParams(layoutParams);
@ -2512,7 +2510,12 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
String pkTime = StringUtil.getDurationText(time * 1000); String pkTime = StringUtil.getDurationText(time * 1000);
livePushRyViewHolder.textTime.setText(String.format(mContext.getString(R.string.pk_time), pkTime)); livePushRyViewHolder.textTime.setText(String.format(mContext.getString(R.string.pk_time), pkTime));
mPkTimeCount = time; mPkTimeCount = time;
pkCountdownTimer(); if (time>0){
String s1 = StringUtil.getDurationText(mPkTimeCount * 1000);
livePushRyViewHolder.textTime.setText(String.format(mContext.getString(R.string.pk_time), s1));
mHandler.sendEmptyMessage(WHAT_PK_TIME2);
}
} }
int pkScoreSize = pkScores.size(); int pkScoreSize = pkScores.size();
if (pkScoreSize == 3) { if (pkScoreSize == 3) {

View File

@ -5013,6 +5013,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
public void upDataPkScore(JSONArray pkScores, int time) { public void upDataPkScore(JSONArray pkScores, int time) {
isShowGif = true; isShowGif = true;
if (detailsView == null) { if (detailsView == null) {
detailsView = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null); detailsView = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
@ -5053,7 +5054,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
}); });
countdownHandler.removeCallbacks(countdownRunnable);
if (time > 0) {
mPkTimeCount = time;
timeTitle.setVisibility(View.VISIBLE);
countdownHandler.post(countdownRunnable);
}
} }
for (int i = 0; i < pkScores.size(); i++) { for (int i = 0; i < pkScores.size(); i++) {
@ -5119,11 +5125,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
} }
if (time > 0) {
mPkTimeCount = time;
timeTitle.setVisibility(View.VISIBLE);
countdownHandler.postAtTime(countdownRunnable, getNextSecondTime());
}
textPkName2.setOnClickListener(new View.OnClickListener() { textPkName2.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {

View File

@ -91,7 +91,6 @@ import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.GiftCacheUtil; import com.yunbao.common.utils.GiftCacheUtil;
import com.yunbao.common.utils.GoogleUtils; import com.yunbao.common.utils.GoogleUtils;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
import com.yunbao.common.utils.LocationUtil; import com.yunbao.common.utils.LocationUtil;
import com.yunbao.common.utils.ProcessResultUtil; import com.yunbao.common.utils.ProcessResultUtil;
@ -1302,7 +1301,12 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
messageNumber = event.getNumber(); messageNumber = event.getNumber();
if (event.getNumber() > 0) { if (event.getNumber() > 0) {
v_table_redpoint.setVisibility(View.VISIBLE); v_table_redpoint.setVisibility(View.VISIBLE);
if (event.getNumber() > 99) {
v_table_redpoint.setText("99+");
} else {
v_table_redpoint.setText(event.getNumber() + ""); v_table_redpoint.setText(event.getNumber() + "");
}
} else { } else {
v_table_redpoint.setVisibility(View.GONE); v_table_redpoint.setVisibility(View.GONE);
v_table_redpoint.setText(""); v_table_redpoint.setText("");