多人PK倒计时bug修改
This commit is contained in:
parent
3d1c4466e0
commit
ae6fdab7e8
@ -879,7 +879,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
d_pk_view.setVisibility(View.VISIBLE);
|
d_pk_view.setVisibility(View.VISIBLE);
|
||||||
if (time != 0) {
|
if (time != 0) {
|
||||||
mPkTimeCount = time;
|
mPkTimeCount = time;
|
||||||
mHandler.sendEmptyMessageAtTime(WHAT_PK_TIME, getNextSecondTime());
|
mHandler.sendEmptyMessageDelayed(WHAT_PK_TIME, getNextSecondTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5057,18 +5057,7 @@ 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;
|
||||||
@ -5081,13 +5070,48 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
* PK倒计时
|
* PK倒计时
|
||||||
*/
|
*/
|
||||||
private String userId2, userId3 = "", userId4;
|
private String userId2, userId3 = "", userId4;
|
||||||
|
private int drPKtIME;
|
||||||
|
|
||||||
public void seisShowGif(boolean isShowGif) {
|
public void seisShowGif(boolean isShowGif) {
|
||||||
this.isShowGif = isShowGif;
|
this.isShowGif = isShowGif;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void upDataPkScore(JSONArray pkScores, int time) {
|
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;
|
||||||
|
timeTitle.setVisibility(View.GONE);
|
||||||
|
countdownHandler.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);
|
||||||
|
textTime.setText(String.format(mContext.getString(R.string.pk_time), s1));
|
||||||
|
Log.e("多人Pk", "countdownRunnable s1:" + s1);
|
||||||
|
countdownHandler.postDelayed(countdownRunnable, 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public void upDataPkScore(JSONArray pkScores, int time) {
|
||||||
isShowGif = true;
|
isShowGif = true;
|
||||||
if (detailsView == null) {
|
if (detailsView == null) {
|
||||||
detailsView = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
|
detailsView = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
|
||||||
@ -5128,11 +5152,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
countdownHandler.removeMessages(WHAT_PK_TIME);
|
|
||||||
if (time > 0) {
|
if (time > 0) {
|
||||||
mPkTimeCount = time;
|
mPkTimeCount = time;
|
||||||
|
if (mShowLianBtn) {
|
||||||
|
removeRunnable = true;
|
||||||
|
} else {
|
||||||
|
countdownHandler.postDelayed(countdownRunnable, 1000);
|
||||||
|
mShowLianBtn = true;
|
||||||
|
drPKtIME = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
countdownTime();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.e("多人Pk", "upDataPkScore mPkTimeCount:" + mPkTimeCount);
|
Log.e("多人Pk", "upDataPkScore mPkTimeCount:" + mPkTimeCount);
|
||||||
@ -5220,23 +5250,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
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() {
|
public void removeDetailView() {
|
||||||
|
|
||||||
@ -5250,7 +5264,8 @@ private synchronized void countdownTime(){
|
|||||||
mHandler.removeMessages(WHAT_PK_TIME);
|
mHandler.removeMessages(WHAT_PK_TIME);
|
||||||
}
|
}
|
||||||
if (countdownHandler != null) {
|
if (countdownHandler != null) {
|
||||||
countdownHandler.removeMessages(WHAT_PK_TIME);
|
removeRunnable = true;
|
||||||
|
mPkTimeCount = 0;
|
||||||
}
|
}
|
||||||
isShowGif = false;
|
isShowGif = false;
|
||||||
if (voteManager != null) {
|
if (voteManager != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user