多人PK倒计时bug修改

This commit is contained in:
18401019693 2024-01-18 16:09:34 +08:00
parent ae6fdab7e8
commit 74b19de11c
2 changed files with 15 additions and 37 deletions

View File

@ -315,7 +315,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public static Handler mHandler;
private static final int WHAT_PK_TIME = 2;//pk时间变化 what
private static int mPkTimeCount;//pk时间
private static int mPkTimeCount, mPkTimeCount2;//pk时间
public static ImageView img_pk_fist_l, img_pk_fist_r;
public RoundedImageView avatar_l1, avatar_l2, avatar_l3, avatar_r1, avatar_r2, avatar_r3;
@ -5057,7 +5057,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
};
private Handler countdownHandler = new Handler();
private View detailsView = null;
private FrameLayout timeTitle;
private TextView textTime;
@ -5076,36 +5075,25 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
this.isShowGif = isShowGif;
}
private boolean removeRunnable = false;
private boolean mShowLianBtn = false;
private Runnable countdownRunnable = new Runnable() {
@Override
public void run() {
if (removeRunnable) {
countdownHandler.removeCallbacks(countdownRunnable);
timeTitle.setVisibility(View.VISIBLE);
Log.e("多人Pk", "countdownRunnable mPkTimeCount:" + mPkTimeCount);
String s1 = StringUtil.getDurationText(mPkTimeCount * 1000);
textTime.setText(String.format(mContext.getString(R.string.pk_time), s1));
Log.e("多人Pk", "countdownRunnable s1:" + s1);
countdownHandler.postDelayed(countdownRunnable, 1000);
removeRunnable = false;
} else {
mPkTimeCount--;
if (mPkTimeCount == 0) {
mShowLianBtn = false;
if (mPkTimeCount2 > 0) {
mPkTimeCount2--;
if (mPkTimeCount2 == 0) {
timeTitle.setVisibility(View.GONE);
countdownHandler.removeCallbacks(countdownRunnable);
timeTitle.removeCallbacks(countdownRunnable);
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.PK_TIME_COUNT));
} else {
timeTitle.setVisibility(View.VISIBLE);
Log.e("多人Pk", "countdownRunnable mPkTimeCount:" + mPkTimeCount);
String s1 = StringUtil.getDurationText(mPkTimeCount * 1000);
Log.e("多人Pk", "countdownRunnable mPkTimeCount:" + mPkTimeCount2);
String s1 = StringUtil.getDurationText(mPkTimeCount2 * 1000);
textTime.setText(String.format(mContext.getString(R.string.pk_time), s1));
Log.e("多人Pk", "countdownRunnable s1:" + s1);
countdownHandler.postDelayed(countdownRunnable, 1000);
timeTitle.postDelayed(countdownRunnable, 1000);
}
}
}
@ -5153,16 +5141,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
});
if (time > 0) {
mPkTimeCount = time;
if (mShowLianBtn) {
removeRunnable = true;
} else {
countdownHandler.postDelayed(countdownRunnable, 1000);
mShowLianBtn = true;
drPKtIME = time;
}
mPkTimeCount2 = time;
drPKtIME = time;
timeTitle.post(countdownRunnable);
}
}
Log.e("多人Pk", "upDataPkScore mPkTimeCount:" + mPkTimeCount);
@ -5258,15 +5239,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mRoot.removeView(detailsView);
detailsView = null;
}
mPkTimeCount = 0;
showAnchorSayAndCallAnchor();
if (mHandler != null) {
mPkTimeCount = 0;
mHandler.removeMessages(WHAT_PK_TIME);
}
if (countdownHandler != null) {
removeRunnable = true;
mPkTimeCount = 0;
}
isShowGif = false;
if (voteManager != null) {
voteManager.hide();

View File

@ -692,7 +692,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
upDataPkScore(pkInfo.getJSONArray("userlist"), pkInfo.getIntValue("drpk_time"));
Log.e("多人Pk", "enterRoomNew drpk_time:" + pkInfo.getIntValue("drpk_time"));
}
// mLivePlayViewHolder.setLayoutInterface(new LivePlayRyViewHolder.PlayViewLayoutInterface() {
// @Override