diff --git a/config.gradle b/config.gradle index 33a33ff33..8853bfc05 100644 --- a/config.gradle +++ b/config.gradle @@ -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, diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 2661b23f2..f2e1eebcd 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -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();