pk 倒计时去掉小时
This commit is contained in:
parent
50bdc01ea9
commit
fd8e805f78
@ -120,6 +120,33 @@ public class StringUtil {
|
|||||||
return sStringBuilder.toString();
|
return sStringBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 把一个long类型的总毫秒数转成时长
|
||||||
|
*/
|
||||||
|
public static String getDurationText2(long mms) {
|
||||||
|
int minutes = (int) ((mms % (1000 * 60 * 60)) / (1000 * 60));
|
||||||
|
int seconds = (int) ((mms % (1000 * 60)) / 1000);
|
||||||
|
sStringBuilder.delete(0, sStringBuilder.length());
|
||||||
|
if (minutes > 0) {
|
||||||
|
if (minutes < 10) {
|
||||||
|
sStringBuilder.append("0");
|
||||||
|
}
|
||||||
|
sStringBuilder.append(String.valueOf(minutes));
|
||||||
|
sStringBuilder.append(":");
|
||||||
|
} else {
|
||||||
|
sStringBuilder.append("00:");
|
||||||
|
}
|
||||||
|
if (seconds > 0) {
|
||||||
|
if (seconds < 10) {
|
||||||
|
sStringBuilder.append("0");
|
||||||
|
}
|
||||||
|
sStringBuilder.append(String.valueOf(seconds));
|
||||||
|
} else {
|
||||||
|
sStringBuilder.append("00");
|
||||||
|
}
|
||||||
|
return sStringBuilder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置视频输出路径
|
* 设置视频输出路径
|
||||||
|
@ -331,7 +331,7 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V
|
|||||||
}
|
}
|
||||||
if (mLiveLinkMicPkViewHolder != null) {
|
if (mLiveLinkMicPkViewHolder != null) {
|
||||||
String s = mIsPkEnd ? mPkTimeString2 : mPkTimeString1;
|
String s = mIsPkEnd ? mPkTimeString2 : mPkTimeString1;
|
||||||
String s1 = StringUtil.getDurationText(mPkTimeCount * 1000);
|
String s1 = StringUtil.getDurationText2(mPkTimeCount * 1000);
|
||||||
Log.i("tag23333", mPkTimeCount + "mPkTimeCount" + s1 + "is" + is);
|
Log.i("tag23333", mPkTimeCount + "mPkTimeCount" + s1 + "is" + is);
|
||||||
if (i == 1 && s1.equals("00:01")) {
|
if (i == 1 && s1.equals("00:01")) {
|
||||||
s1 = "00:00";
|
s1 = "00:00";
|
||||||
@ -1729,11 +1729,11 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V
|
|||||||
layoutParams.topMargin = DpUtil.dp2px(165);
|
layoutParams.topMargin = DpUtil.dp2px(165);
|
||||||
livePushSwViewHolder.timeTitle.setLayoutParams(layoutParams);
|
livePushSwViewHolder.timeTitle.setLayoutParams(layoutParams);
|
||||||
livePushSwViewHolder.timeTitle.setVisibility(View.VISIBLE);
|
livePushSwViewHolder.timeTitle.setVisibility(View.VISIBLE);
|
||||||
String pkTime = StringUtil.getDurationText(time * 1000);
|
String pkTime = StringUtil.getDurationText2(time * 1000);
|
||||||
livePushSwViewHolder.textTime.setText(String.format(mContext.getString(R.string.pk_time), pkTime));
|
livePushSwViewHolder.textTime.setText(String.format(mContext.getString(R.string.pk_time), pkTime));
|
||||||
mPkTimeCount = time;
|
mPkTimeCount = time;
|
||||||
if (time > 0) {
|
if (time > 0) {
|
||||||
String s1 = StringUtil.getDurationText(mPkTimeCount * 1000);
|
String s1 = StringUtil.getDurationText2(mPkTimeCount * 1000);
|
||||||
livePushSwViewHolder.textTime.setText(String.format(mContext.getString(R.string.pk_time), s1));
|
livePushSwViewHolder.textTime.setText(String.format(mContext.getString(R.string.pk_time), s1));
|
||||||
mHandler.sendEmptyMessage(WHAT_PK_TIME2);
|
mHandler.sendEmptyMessage(WHAT_PK_TIME2);
|
||||||
}
|
}
|
||||||
@ -1989,7 +1989,7 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V
|
|||||||
mPkTimeCount--;
|
mPkTimeCount--;
|
||||||
if (mPkTimeCount > 0) {//
|
if (mPkTimeCount > 0) {//
|
||||||
if (mHandler != null) {
|
if (mHandler != null) {
|
||||||
String s1 = StringUtil.getDurationText(mPkTimeCount * 1000);
|
String s1 = StringUtil.getDurationText2(mPkTimeCount * 1000);
|
||||||
livePushSwViewHolder.textTime.setText(String.format(mContext.getString(R.string.pk_time), s1));
|
livePushSwViewHolder.textTime.setText(String.format(mContext.getString(R.string.pk_time), s1));
|
||||||
mHandler.sendEmptyMessageAtTime(WHAT_PK_TIME2, getNextSecondTime());
|
mHandler.sendEmptyMessageAtTime(WHAT_PK_TIME2, getNextSecondTime());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user