[m1]
[文案修改、时间显示时分秒]
This commit is contained in:
yangyakun
2023-02-16 07:56:44 +08:00
parent 208dcf2699
commit ec7ef2161d
3 changed files with 21 additions and 2 deletions

View File

@@ -85,6 +85,11 @@ class BusPassengerFunctionSoftFragment :
if(!buttonView.isPressed){
return@setOnCheckedChangeListener
}
if(isChecked){
tv_aircondition_switch.setText("关闭空调")
}else{
tv_aircondition_switch.setText("打开空调")
}
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
if (rg_setting_pattern.checkedRadioButtonId == R.id.rb_pattern_heating) {
if (isChecked) {// 打开暖风机

View File

@@ -184,8 +184,8 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
) {
super.setProgressAndTime(progress, secProgress, currentTime, totalTime, forceChange)
//时间显示
currentTimeTextView.text = TimeTransformUtils.stringForTime(currentTime)
totalTimeTextView.text = TimeTransformUtils.stringForTime(totalTime)
currentTimeTextView.text = TimeTransformUtils.stringForTimeWithHours(currentTime)
totalTimeTextView.text = TimeTransformUtils.stringForTimeWithHours(totalTime)
if(currentTime>=totalTime-3000){//
this.currentTime = -1
}else{

View File

@@ -26,5 +26,19 @@ public final class TimeTransformUtils {
}
}
public static String stringForTimeWithHours(int timeMs) {
if (timeMs <= 0 || timeMs >= 24 * 60 * 60 * 1000) {
return "00:00";
}
int totalSeconds = timeMs / 1000;
int seconds = totalSeconds % 60;
int minutes = (totalSeconds / 60) % 60;
int hours = totalSeconds / 3600;
StringBuilder stringBuilder = new StringBuilder();
Formatter mFormatter = new Formatter(stringBuilder, Locale.getDefault());
return mFormatter.format("%d:%02d:%02d", hours, minutes, seconds).toString();
}
}