1.map和直播页增加用户和宠物虚线设置
2.优化帮助页面 3.支付页面去掉税的计算 4.GPS: Off 改为GPS: Sleep; 5.map页增加位置更新时间格式:当更新滞后超过2倍的上报间隔时,才显示 (2h 35m ago)”,显示休眠中时,不显示“(2h 35m ago) 6.运动数据改为查看30天数据 7.历史轨迹限制只能看30天数据
This commit is contained in:
@@ -37,6 +37,7 @@ import androidx.annotation.StringDef
|
||||
MMKVKey.isGpsToGCJ02,
|
||||
MMKVKey.MapType,
|
||||
MMKVKey.ShowFence,
|
||||
MMKVKey.ShowDashedLine,
|
||||
MMKVKey.isCrash,
|
||||
MMKVKey.AvailableOrder,
|
||||
MMKVKey.isFirstCheckBleOpen,
|
||||
@@ -92,6 +93,7 @@ annotation class MMKVKey {
|
||||
|
||||
//map页是否显示围栏
|
||||
const val ShowFence = "isShowFence"
|
||||
const val ShowDashedLine = "isShowDashedLine"
|
||||
|
||||
//是首次打开APP
|
||||
const val FirstOpen = "firstOpen"
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.util.Calendar
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
import java.util.TimeZone
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.regex.Pattern
|
||||
import kotlin.math.atan2
|
||||
import kotlin.math.cos
|
||||
@@ -217,6 +218,40 @@ class Utils {
|
||||
return "${fill2Digits(hour)}:${fill2Digits(minutes)}:${fill2Digits(second)}"
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化2个时间相差多少
|
||||
*/
|
||||
fun getTimeDifference(startMillis: Long, endMillis: Long): String {
|
||||
var diff = endMillis - startMillis
|
||||
val days = TimeUnit.MILLISECONDS.toDays(diff)
|
||||
diff -= TimeUnit.DAYS.toMillis(days)
|
||||
|
||||
val hours = TimeUnit.MILLISECONDS.toHours(diff)
|
||||
diff -= TimeUnit.HOURS.toMillis(hours)
|
||||
|
||||
val minutes = TimeUnit.MILLISECONDS.toMinutes(diff)
|
||||
var timeStr: String
|
||||
if (days > 0) {
|
||||
timeStr = if (days > 1) {
|
||||
"$days days"
|
||||
} else {
|
||||
"$days day"
|
||||
}
|
||||
if (hours > 0) {
|
||||
timeStr += " ${hours}h"
|
||||
}
|
||||
} else {
|
||||
if (hours > 0) {
|
||||
timeStr = "${hours}h"
|
||||
if (minutes > 0) timeStr += " ${minutes}m"
|
||||
} else {
|
||||
timeStr = if (minutes > 0) "${minutes}m"
|
||||
else "1m"
|
||||
}
|
||||
}
|
||||
return timeStr
|
||||
}
|
||||
|
||||
/**
|
||||
* 把秒转换为 day hour min
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user