Fix statistics activity

This commit is contained in:
Milos Kozak 2020-01-10 00:01:42 +01:00
parent 67b3b2613d
commit ae87a6ae0c

View file

@ -53,8 +53,9 @@ object ActivityMonitor : Application.ActivityLifecycleCallbacks {
var result = ""
for ((key, value) in keys)
if (key.startsWith("Monitor") && key.endsWith("total")) {
val v = if (value is Long) value else SafeParse.stringToLong(value as String)
val activity = key.split("_")[1].replace("Activity", "")
val duration = DateUtil.niceTimeScalar(value as Long)
val duration = DateUtil.niceTimeScalar(v as Long)
val start = SP.getLong(key.replace("total", "start"), 0)
val days = T.msecs(DateUtil.now() - start).days()
result += "<b><span style=\"color:yellow\">$activity:</span></b> <b>$duration</b> in <b>$days</b> days<br>"