多人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 = [ 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包 // true表示谷歌支付 false 0 1 2 3 samsung包
isGooglePlay : 3, isGooglePlay : 3,
// //0
isUploadLog : true, isUploadLog : true,
// //
isPluginModel : 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.WordUtil;
import com.yunbao.common.utils.formatBigNum; import com.yunbao.common.utils.formatBigNum;
import com.yunbao.common.views.AbsViewHolder; 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.ClipPathCircleImage;
import com.yunbao.common.views.weight.FullServiceNotificationView; import com.yunbao.common.views.weight.FullServiceNotificationView;
import com.yunbao.common.views.weight.NobleNoticeView; 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.bean.WishlistItemModel;
import com.yunbao.live.custom.LiveLightView; import com.yunbao.live.custom.LiveLightView;
import com.yunbao.live.custom.RightGradual; import com.yunbao.live.custom.RightGradual;
import com.yunbao.common.views.TopGradual;
import com.yunbao.live.dialog.GiftWallDialog; import com.yunbao.live.dialog.GiftWallDialog;
import com.yunbao.live.dialog.LiveContactDetailsSendGiftDialog; import com.yunbao.live.dialog.LiveContactDetailsSendGiftDialog;
import com.yunbao.live.dialog.LiveFaceUnityDialogFragment; import com.yunbao.live.dialog.LiveFaceUnityDialogFragment;
@ -1823,7 +1823,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
* 重置数据 * 重置数据
*/ */
public void resetView() { public void resetView() {
countdownHandler.removeCallbacks(countdownRunnable);
svgaImageViewHashMap.clear(); svgaImageViewHashMap.clear();
pa_pao_layout.removeAllViews(); pa_pao_layout.removeAllViews();
timeHandler.removeCallbacks(timeRunnable); timeHandler.removeCallbacks(timeRunnable);
@ -4446,7 +4445,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (showLoadingDialog()) { if (showLoadingDialog()) {
return; return;
} }
if (bean.getActivityId() == -1) {//-1写死跳活动弹窗 if (bean.getActivityId() == -1) {//-1写死跳活动弹窗
Bus.get().post(new LiveAudienceEvent() Bus.get().post(new LiveAudienceEvent()
.setActivity(true) .setActivity(true)
.setType(LiveAudienceEvent.LiveAudienceType.BOTTOM_COLLECTION)); .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 View detailsView = null;
private FrameLayout timeTitle; private FrameLayout timeTitle;
private TextView textTime; 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) { if (time > 0) {
mPkTimeCount = time; mPkTimeCount = time;
timeTitle.setVisibility(View.VISIBLE);
countdownHandler.post(countdownRunnable); countdownTime();
} }
} }
Log.e("多人Pk", "upDataPkScore mPkTimeCount:" + mPkTimeCount); Log.e("多人Pk", "upDataPkScore mPkTimeCount:" + mPkTimeCount);
@ -5210,26 +5220,23 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}); });
} }
private synchronized void countdownTime(){
private Runnable countdownRunnable = new Runnable() { mPkTimeCount--;
@Override if (mPkTimeCount > 0) {//
public void run() { timeTitle.setVisibility(View.VISIBLE);
mPkTimeCount--; Log.e("多人Pk", "countdownRunnable mPkTimeCount:" + mPkTimeCount);
if (mPkTimeCount > 0) {// String s1 = StringUtil.getDurationText(mPkTimeCount * 1000);
Log.e("多人Pk", "countdownRunnable mPkTimeCount:" + mPkTimeCount); textTime.setText(String.format(mContext.getString(R.string.pk_time), s1));
String s1 = StringUtil.getDurationText(mPkTimeCount * 1000); Log.e("多人Pk", "countdownRunnable s1:" + s1);
textTime.setText(String.format(mContext.getString(R.string.pk_time), s1)); countdownHandler.sendEmptyMessageAtTime(WHAT_PK_TIME, getNextSecondTime());
Log.e("多人Pk", "countdownRunnable s1:" + s1); } else {
countdownHandler.postAtTime(countdownRunnable, getNextSecondTime()); mPkTimeCount = 0;
} else { timeTitle.setVisibility(View.GONE);
mPkTimeCount = 0; countdownHandler.removeCallbacksAndMessages(null);
timeTitle.setVisibility(View.GONE); Bus.get().post(new LiveAudienceEvent()
countdownHandler.removeCallbacks(countdownRunnable); .setType(LiveAudienceEvent.LiveAudienceType.PK_TIME_COUNT));
Bus.get().post(new LiveAudienceEvent() }
.setType(LiveAudienceEvent.LiveAudienceType.PK_TIME_COUNT)); }
}
}
};
public void removeDetailView() { public void removeDetailView() {
@ -5242,6 +5249,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (mHandler != null) { if (mHandler != null) {
mHandler.removeMessages(WHAT_PK_TIME); mHandler.removeMessages(WHAT_PK_TIME);
} }
if (countdownHandler!=null){
countdownHandler.removeMessages(WHAT_PK_TIME);
}
isShowGif = false; isShowGif = false;
if (voteManager != null) { if (voteManager != null) {
voteManager.hide(); voteManager.hide();