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 0004354b5..85f0ef2d0 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -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(); diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 20f9db153..9de03b3c3 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -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