From 0761e47959af0145e28c629a9f8151686d4c61c0 Mon Sep 17 00:00:00 2001 From: xufulong <839789740@qq.com> Date: Mon, 6 Apr 2020 22:58:35 +0800 Subject: [PATCH] translate TimeUtil into English translate TimeUtil into English --- .../java/com/frank/ffmpeg/util/TimeUtil.java | 47 ++++++++++--------- .../frank/ffmpeg/view/VideoPreviewBar.java | 2 +- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/com/frank/ffmpeg/util/TimeUtil.java b/app/src/main/java/com/frank/ffmpeg/util/TimeUtil.java index b0f9243..ede7d47 100644 --- a/app/src/main/java/com/frank/ffmpeg/util/TimeUtil.java +++ b/app/src/main/java/com/frank/ffmpeg/util/TimeUtil.java @@ -6,18 +6,19 @@ import java.util.Date; import java.util.Locale; /** - * 时间转换工具类 + * the tool of time transforming * Created by frank on 2018/11/12. */ 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 - * @return 年月日时分秒 yyyy/MM/dd HH:mm:ss + * @return yyyy/MM/dd HH:mm:ss */ public static String getDetailTime(long time) { SimpleDateFormat format = new SimpleDateFormat(YMDHMS, Locale.getDefault()); @@ -26,9 +27,10 @@ public class TimeUtil { } /** - * 时间转为时间戳 + * convert normal time into timestamp + * * @param time time - * @return 时间戳 + * @return timestamp */ public static long getLongTime(String time, Locale locale) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(YMDHMS, locale); @@ -41,37 +43,38 @@ public class TimeUtil { return 0; } - private static String addZero(int time){ - if (time >= 0 && time < 10){ - return "0" + time; - }else if(time >= 10){ + private static String addZero(int time) { + if (time >= 0 && time < 10) { + return "0" + time; + } else if (time >= 10) { return "" + time; - }else { + } else { return ""; } } /** - * 获取视频时长 + * convert timestamp into video time + * * @param time time - * @return 视频时长 + * @return video time */ - public static String getVideoTime(long time){ + public static String getVideoTime(long time) { if (time <= 0) return null; time = time / 1000; - int second, minute=0, hour=0; - second = (int)time % 60; + int second, minute = 0, hour = 0; + second = (int) time % 60; time = time / 60; - if (time > 0){ - minute = (int)time % 60; - hour = (int)time / 60; + if (time > 0) { + minute = (int) time % 60; + hour = (int) time / 60; } - if (hour > 0){ + if (hour > 0) { return addZero(hour) + ":" + addZero(minute) + ":" + addZero(second); - }else if (minute > 0){ + } else if (minute > 0) { return addZero(minute) + ":" + addZero(second); - }else { + } else { return "00:" + addZero(second); } } diff --git a/app/src/main/java/com/frank/ffmpeg/view/VideoPreviewBar.java b/app/src/main/java/com/frank/ffmpeg/view/VideoPreviewBar.java index 3d4f69a..d9a192c 100644 --- a/app/src/main/java/com/frank/ffmpeg/view/VideoPreviewBar.java +++ b/app/src/main/java/com/frank/ffmpeg/view/VideoPreviewBar.java @@ -19,7 +19,7 @@ import com.frank.ffmpeg.util.ScreenUtil; import com.frank.ffmpeg.util.TimeUtil; /** - * 视频拖动实时预览的控件 + * the custom view of preview SeekBar * Created by frank on 2019/11/16. */