This commit is contained in:
Milos Kozak 2022-04-24 17:46:07 +02:00
parent 09433d6a4f
commit 9b064404ac
2 changed files with 8 additions and 14 deletions

View file

@ -11,7 +11,6 @@ import android.graphics.Point
import android.graphics.Rect import android.graphics.Rect
import android.os.PowerManager import android.os.PowerManager
import android.support.wearable.watchface.WatchFaceStyle import android.support.wearable.watchface.WatchFaceStyle
import android.text.format.DateFormat
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.WindowInsets import android.view.WindowInsets
@ -239,12 +238,9 @@ class BigChartWatchface : WatchFace() {
return (System.currentTimeMillis() - singleBg.timeStamp).toDouble() return (System.currentTimeMillis() - singleBg.timeStamp).toDouble()
} }
private fun readingAge(): String { private fun readingAge(): String =
if (singleBg.timeStamp == 0L) return "--'" if (singleBg.timeStamp == 0L) "--'"
val minutesAgo = floor(timeSince() / (1000 * 60)).toInt() else "${floor(timeSince() / (1000 * 60)).toInt()}'"
return if (minutesAgo == 1) "$minutesAgo'"
else "$minutesAgo'"
}
override fun onDestroy() { override fun onDestroy() {
disposable.clear() disposable.clear()
@ -276,7 +272,7 @@ class BigChartWatchface : WatchFace() {
mTimestamp?.text = readingAge() mTimestamp?.text = readingAge()
mAvgDelta?.visibility = sp.getBoolean(R.string.key_show_external_status, true).toVisibility() mAvgDelta?.visibility = sp.getBoolean(R.string.key_show_external_status, true).toVisibility()
statusView?.visibility = sp.getBoolean(R.string.key_show_external_status, true).toVisibility() statusView?.visibility = sp.getBoolean(R.string.key_show_external_status, true).toVisibility()
statusView?.text = status.externalStatus + if (sp.getBoolean(R.string.key_show_cob, true)) (" " + this.status.cob) else "" statusView?.text = status.externalStatus + if (sp.getBoolean(R.string.key_show_cob, true)) (" " + this.status.cob) else ""
} }
private fun setColor() { private fun setColor() {

View file

@ -185,12 +185,10 @@ class NoChartWatchface : WatchFace() {
fun timeSince(): Double = (System.currentTimeMillis() - singleBg.timeStamp).toDouble() fun timeSince(): Double = (System.currentTimeMillis() - singleBg.timeStamp).toDouble()
private fun readingAge(): String { private fun readingAge(): String =
if (singleBg.timeStamp == 0L) return "--'" if (singleBg.timeStamp == 0L) "--'"
val minutesAgo = floor(timeSince() / (1000 * 60)).toInt() else "${floor(timeSince() / (1000 * 60)).toInt()}'"
return if (minutesAgo == 1) "$minutesAgo'"
else "$minutesAgo'"
}
override fun onDestroy() { override fun onDestroy() {
disposable.clear() disposable.clear()