多人PK倒计时bug修改

This commit is contained in:
18401019693 2024-01-18 13:37:49 +08:00
parent d9951b5a35
commit 9963b37b6f
2 changed files with 40 additions and 30 deletions

View File

@ -9,9 +9,9 @@ ext {
]
manifestPlaceholders = [
//
// serverHost : "https://napi.yaoulive.com",
serverHost : "https://napi.yaoulive.com",
//
serverHost : " https://ceshi.yaoulive.com",
// serverHost : " https://ceshi.yaoulive.com",
//
@ -22,7 +22,7 @@ ext {
// true表示谷歌支付 false 0 1 2 3 samsung包
isGooglePlay : 3,
//
//0
isUploadLog : true,
//
isPluginModel : true,

View File

@ -133,6 +133,7 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.utils.formatBigNum;
import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.common.views.TopGradual;
import com.yunbao.common.views.weight.ClipPathCircleImage;
import com.yunbao.common.views.weight.FullServiceNotificationView;
import com.yunbao.common.views.weight.NobleNoticeView;
@ -160,7 +161,6 @@ import com.yunbao.live.bean.LiveWishlistBean;
import com.yunbao.live.bean.WishlistItemModel;
import com.yunbao.live.custom.LiveLightView;
import com.yunbao.live.custom.RightGradual;
import com.yunbao.common.views.TopGradual;
import com.yunbao.live.dialog.GiftWallDialog;
import com.yunbao.live.dialog.LiveContactDetailsSendGiftDialog;
import com.yunbao.live.dialog.LiveFaceUnityDialogFragment;
@ -1823,7 +1823,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
* 重置数据
*/
public void resetView() {
countdownHandler.removeCallbacks(countdownRunnable);
svgaImageViewHashMap.clear();
pa_pao_layout.removeAllViews();
timeHandler.removeCallbacks(timeRunnable);
@ -4446,7 +4445,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (showLoadingDialog()) {
return;
}
if (bean.getActivityId() == -1) {//-1写死跳活动弹窗
if (bean.getActivityId() == -1) {//-1写死跳活动弹窗
Bus.get().post(new LiveAudienceEvent()
.setActivity(true)
.setType(LiveAudienceEvent.LiveAudienceType.BOTTOM_COLLECTION));
@ -5058,7 +5057,18 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
};
private Handler countdownHandler = new Handler();
private Handler countdownHandler = new Handler() {
@Override
public void handleMessage(@NonNull Message msg) {
switch (msg.what) {
case WHAT_PK_TIME:
countdownTime();
break;
}
super.handleMessage(msg);
}
};
private View detailsView = null;
private FrameLayout timeTitle;
private TextView textTime;
@ -5118,11 +5128,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
});
countdownHandler.removeCallbacks(countdownRunnable);
countdownHandler.removeMessages(WHAT_PK_TIME);
if (time > 0) {
mPkTimeCount = time;
timeTitle.setVisibility(View.VISIBLE);
countdownHandler.post(countdownRunnable);
countdownTime();
}
}
Log.e("多人Pk", "upDataPkScore mPkTimeCount:" + mPkTimeCount);
@ -5210,26 +5220,23 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
});
}
private Runnable countdownRunnable = new Runnable() {
@Override
public void run() {
mPkTimeCount--;
if (mPkTimeCount > 0) {//
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.postAtTime(countdownRunnable, getNextSecondTime());
} else {
mPkTimeCount = 0;
timeTitle.setVisibility(View.GONE);
countdownHandler.removeCallbacks(countdownRunnable);
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.PK_TIME_COUNT));
}
}
};
private synchronized void countdownTime(){
mPkTimeCount--;
if (mPkTimeCount > 0) {//
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.sendEmptyMessageAtTime(WHAT_PK_TIME, getNextSecondTime());
} else {
mPkTimeCount = 0;
timeTitle.setVisibility(View.GONE);
countdownHandler.removeCallbacksAndMessages(null);
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.PK_TIME_COUNT));
}
}
public void removeDetailView() {
@ -5242,6 +5249,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (mHandler != null) {
mHandler.removeMessages(WHAT_PK_TIME);
}
if (countdownHandler!=null){
countdownHandler.removeMessages(WHAT_PK_TIME);
}
isShowGif = false;
if (voteManager != null) {
voteManager.hide();