diff --git a/app/src/main/java/com/frank/ffmpeg/tool/LrcLineTool.kt b/app/src/main/java/com/frank/ffmpeg/tool/LrcLineTool.kt index c8d1ce9..451b305 100644 --- a/app/src/main/java/com/frank/ffmpeg/tool/LrcLineTool.kt +++ b/app/src/main/java/com/frank/ffmpeg/tool/LrcLineTool.kt @@ -1,6 +1,7 @@ package com.frank.ffmpeg.tool import com.frank.ffmpeg.model.LrcLine +import com.frank.ffmpeg.util.TimeUtil import java.util.ArrayList import java.util.Collections @@ -28,7 +29,7 @@ object LrcLineTool { val mLrcLine = LrcLine() mLrcLine.content = content mLrcLine.timeString = temp - val startTime = timeConvert(temp) + val startTime = TimeUtil.timeConvert(temp) mLrcLine.startTime = startTime listTimes.add(mLrcLine) } @@ -40,18 +41,6 @@ object LrcLineTool { } - /** - * string time to milliseconds - */ - private fun timeConvert(timeStr: String): Long { - var timeString = timeStr - timeString = timeString.replace('.', ':') - val times = timeString.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() - return (Integer.valueOf(times[0]) * 60 * 1000 + - Integer.valueOf(times[1]) * 1000 + - Integer.valueOf(times[2])).toLong() - } - fun getLrcLine(line: String?): List? { if (line == null || line.isEmpty()) { return null diff --git a/app/src/main/java/com/frank/ffmpeg/util/TimeUtil.kt b/app/src/main/java/com/frank/ffmpeg/util/TimeUtil.kt index af743b5..7d85562 100644 --- a/app/src/main/java/com/frank/ffmpeg/util/TimeUtil.kt +++ b/app/src/main/java/com/frank/ffmpeg/util/TimeUtil.kt @@ -79,4 +79,15 @@ object TimeUtil { } } + /** + * string time to milliseconds + */ + fun timeConvert(timeStr: String): Long { + var timeString = timeStr + timeString = timeString.replace('.', ':') + val times = timeString.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() + return (Integer.valueOf(times[0]) * 60 * 1000 + + Integer.valueOf(times[1]) * 1000 + + Integer.valueOf(times[2])).toLong() + } }