diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java index 7bffad25e..c599c1e39 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java @@ -39,6 +39,7 @@ import com.tencent.trtc.TRTCCloud; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.bean.UserBean; import com.yunbao.common.event.AnchorInfoEvent; +import com.yunbao.common.event.FollowEvent; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.live.LiveNetManager; @@ -304,18 +305,19 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { */ int i = 0; - private void nextPkTimeCountDown() { - Log.i("vvvs", "mHandler:" + (mHandler != null)); + private void nextPkTimeCountDown(int is) { + if (mHandler != null) { mHandler.sendEmptyMessageAtTime(WHAT_PK_TIME, getNextSecondTime()); } if (mLiveLinkMicPkViewHolder != null) { String s = mIsPkEnd ? mPkTimeString2 : mPkTimeString1; String s1 = StringUtil.getDurationText(mPkTimeCount * 1000); -// if (i == 1 && s1.equals("00:01")) { -// s1 = "00:00"; -// i = 0; -// } + Log.i("tag23333",mPkTimeCount+"mPkTimeCount"+s1+"is"+is); + if (i == 1 && s1.equals("00:01")) { + s1 = "00:00"; + i = 0; + } if (rtcRoom != null) { ScreenDimenUtil util = ScreenDimenUtil.getInstance(); int mScreenWdith = util.getScreenWdith(); @@ -328,8 +330,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { Log.i("tts", s1); mLiveLinkMicPkViewHolder.setTime(s + " " + s1); - if (i == 0 && s1.equals("00:01") && mIsAnchor && !s.contains("懲罰")) { - i = 1; + if ( s1.equals("00:01") && mIsAnchor && !s.contains("懲罰")) { HttpClient.getInstance().get("Livepk.endPK", "Livepk.endPK") .params("uid", CommonAppConfig.getInstance().getUid()) .params("addtime", "00:00") @@ -384,11 +385,11 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { * pk时间倒计时 */ private void changePkTime() { - if (mPkTimeCount < 0) return; + if (mPkTimeCount<0)return; mPkTimeCount--; Log.i("vvvs", "mPkTimeCount:" + mPkTimeCount); if (mPkTimeCount >= 0) {// - nextPkTimeCountDown(); + nextPkTimeCountDown(1); if (mContext instanceof LiveAudienceActivity) { ((LiveAudienceActivity) mContext).setPkStatus(true); } @@ -1921,7 +1922,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { mPkTimeCount = pkTime; Log.d("mPkTimeCount1", "" + mPkTimeCount + ";mPkTimeFromServer=" + mPkTimeFromServer); mPkTimeFromServer = pkTime; - nextPkTimeCountDown(); + nextPkTimeCountDown(2); } @@ -1957,7 +1958,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { Log.d("mPkTimeCount1", "" + mPkTimeCount + ";mPkTimeFromServer=" + mPkTimeFromServer); // mPkTimeFromServer=pkTime; //恢复播放画面 - nextPkTimeCountDown(); + nextPkTimeCountDown(3); } @@ -1984,7 +1985,6 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { } mLiveLinkMicPkViewHolder.startAnim(); mLiveLinkMicPkViewHolder.showTime(); - nextPkTimeCountDown(); if (mIsAnchor) { ((LiveRyAnchorActivity) mContext).setPkBtnVisible(false); mPkTimeCount = PK_TIME_MAX; @@ -1993,6 +1993,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { // mPkTimeCount=mPkTimeFromServer; mPkTimeCount = PK_TIME_MAX; } + nextPkTimeCountDown(4); Log.d("mPkTimeCount2", "" + mPkTimeCount + ";mPkTimeFromServer=" + mPkTimeFromServer); } @@ -2036,7 +2037,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { mLiveLinkMicPkViewHolder.end(-1); } mPkTimeCount = PK_TIME_MAX_2;//进入惩罚时间 - nextPkTimeCountDown(); + nextPkTimeCountDown(5); } } @@ -2164,7 +2165,6 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { mHandler.removeCallbacksAndMessages(null); } mSocketRyClient = null; - mHandler = null; if (mLiveLinkMicPkViewHolder != null) { mLiveLinkMicPkViewHolder.release(); }