translate TimeUtil into English

translate TimeUtil into English
pull/112/head
xufulong 5 years ago
parent 85fb33cfce
commit 0761e47959
  1. 45
      app/src/main/java/com/frank/ffmpeg/util/TimeUtil.java
  2. 2
      app/src/main/java/com/frank/ffmpeg/view/VideoPreviewBar.java

@ -6,18 +6,19 @@ import java.util.Date;
import java.util.Locale; import java.util.Locale;
/** /**
* 时间转换工具类 * the tool of time transforming
* Created by frank on 2018/11/12. * Created by frank on 2018/11/12.
*/ */
public class TimeUtil { public class TimeUtil {
private static final String YMDHMS= "yyyy-MM-dd HH:mm:ss"; private static final String YMDHMS = "yyyy-MM-dd HH:mm:ss";
/** /**
* 时间戳年月日时分秒 * convert timestramp into String
*
* @param time time * @param time time
* @return 年月日时分秒 yyyy/MM/dd HH:mm:ss * @return yyyy/MM/dd HH:mm:ss
*/ */
public static String getDetailTime(long time) { public static String getDetailTime(long time) {
SimpleDateFormat format = new SimpleDateFormat(YMDHMS, Locale.getDefault()); SimpleDateFormat format = new SimpleDateFormat(YMDHMS, Locale.getDefault());
@ -26,9 +27,10 @@ public class TimeUtil {
} }
/** /**
* 时间转为时间戳 * convert normal time into timestamp
*
* @param time time * @param time time
* @return 时间戳 * @return timestamp
*/ */
public static long getLongTime(String time, Locale locale) { public static long getLongTime(String time, Locale locale) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(YMDHMS, locale); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(YMDHMS, locale);
@ -41,37 +43,38 @@ public class TimeUtil {
return 0; return 0;
} }
private static String addZero(int time){ private static String addZero(int time) {
if (time >= 0 && time < 10){ if (time >= 0 && time < 10) {
return "0" + time; return "0" + time;
}else if(time >= 10){ } else if (time >= 10) {
return "" + time; return "" + time;
}else { } else {
return ""; return "";
} }
} }
/** /**
* 获取视频时长 * convert timestamp into video time
*
* @param time time * @param time time
* @return 视频时长 * @return video time
*/ */
public static String getVideoTime(long time){ public static String getVideoTime(long time) {
if (time <= 0) if (time <= 0)
return null; return null;
time = time / 1000; time = time / 1000;
int second, minute=0, hour=0; int second, minute = 0, hour = 0;
second = (int)time % 60; second = (int) time % 60;
time = time / 60; time = time / 60;
if (time > 0){ if (time > 0) {
minute = (int)time % 60; minute = (int) time % 60;
hour = (int)time / 60; hour = (int) time / 60;
} }
if (hour > 0){ if (hour > 0) {
return addZero(hour) + ":" + addZero(minute) + ":" + addZero(second); return addZero(hour) + ":" + addZero(minute) + ":" + addZero(second);
}else if (minute > 0){ } else if (minute > 0) {
return addZero(minute) + ":" + addZero(second); return addZero(minute) + ":" + addZero(second);
}else { } else {
return "00:" + addZero(second); return "00:" + addZero(second);
} }
} }

@ -19,7 +19,7 @@ import com.frank.ffmpeg.util.ScreenUtil;
import com.frank.ffmpeg.util.TimeUtil; import com.frank.ffmpeg.util.TimeUtil;
/** /**
* 视频拖动实时预览的控件 * the custom view of preview SeekBar
* Created by frank on 2019/11/16. * Created by frank on 2019/11/16.
*/ */

Loading…
Cancel
Save