Skip to content

Commit 6b12921

Browse files
committed
Revert "prepare for wear"
This reverts commit d0aaa69.
1 parent 2ca7d24 commit 6b12921

13 files changed

Lines changed: 32 additions & 135 deletions

File tree

core/interfaces/src/main/kotlin/app/aaps/core/interfaces/rx/weardata/EventData.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,8 @@ sealed class EventData : Event() {
255255
val avgDeltaDetailed: String = "--",
256256
val sgvLevel: Long = 0,
257257
val sgv: Double,
258-
val veryHigh: Double, // veryHighLine
259258
val high: Double, // highLine
260259
val low: Double, // lowLine
261-
val veryLow: Double, // veryLowLine
262260
val color: Int = 0,
263261
val deltaMgdl: Double? = null,
264262
val avgDeltaMgdl: Double? = null,

core/interfaces/src/test/kotlin/app/aaps/core/interfaces/rx/weardata/EventDataTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,19 @@ class EventDataTest {
140140
assertThat(EventData.deserializeByte(it.serializeByte())).isEqualTo(it)
141141
assertThat(EventData.deserialize(it.serialize())).isEqualTo(it)
142142
}
143-
EventData.SingleBg(dataset = 0, 1, sgv = 2.0, veryHigh = 5.0, high = 3.0, low = 4.0, veryLow = 6.0).let {
143+
EventData.SingleBg(dataset = 0, 1, sgv = 2.0, high = 3.0, low = 4.0).let {
144144
assertThat(EventData.deserializeByte(it.serializeByte())).isEqualTo(it)
145145
assertThat(EventData.deserialize(it.serialize())).isEqualTo(it)
146146
}
147-
EventData.GraphData(arrayListOf(EventData.SingleBg(dataset = 0, 1, sgv = 2.0, veryHigh = 5.0, high = 3.0, low = 4.0, veryLow = 6.0))).let {
147+
EventData.GraphData(arrayListOf(EventData.SingleBg(dataset = 0, 1, sgv = 2.0, high = 3.0, low = 4.0))).let {
148148
assertThat(EventData.deserializeByte(it.serializeByte())).isEqualTo(it)
149149
assertThat(EventData.deserialize(it.serialize())).isEqualTo(it)
150150
}
151151
EventData.TreatmentData(
152152
arrayListOf(EventData.TreatmentData.TempBasal(1, 2.0, 3, 4.0, 5.0)),
153153
arrayListOf(EventData.TreatmentData.Basal(1, 2, 3.0)),
154154
arrayListOf(EventData.TreatmentData.Treatment(1, 2.0, 3.0, true, isValid = true)),
155-
arrayListOf(EventData.SingleBg(dataset = 0, 1, sgv = 2.0, veryHigh = 5.0, high = 3.0, low = 4.0, veryLow = 6.0))
155+
arrayListOf(EventData.SingleBg(dataset = 0, 1, sgv = 2.0, high = 3.0, low = 4.0))
156156
).let {
157157
assertThat(EventData.deserializeByte(it.serializeByte())).isEqualTo(it)
158158
assertThat(EventData.deserialize(it.serialize())).isEqualTo(it)

plugins/sync/src/main/kotlin/app/aaps/plugins/sync/tizen/TizenPlugin.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,8 @@ class TizenPlugin @Inject constructor(
125125
bundle.putString("slopeArrow", lastBG.trendArrow.text) // direction arrow as string
126126
bundle.putDouble("deltaMgdl", glucoseStatus.delta) // bg delta in mgdl
127127
bundle.putDouble("avgDeltaMgdl", glucoseStatus.shortAvgDelta) // average bg delta
128-
bundle.putDouble("veryHigh", preferences.get(UnitDoubleKey.OverviewVeryHighMark)) // predefined topmost value of in range (yellow area)
129128
bundle.putDouble("high", preferences.get(UnitDoubleKey.OverviewHighMark)) // predefined top value of in range (green area)
130129
bundle.putDouble("low", preferences.get(UnitDoubleKey.OverviewLowMark)) // predefined bottom value of in range
131-
bundle.putDouble("veryLow", preferences.get(UnitDoubleKey.OverviewVeryLowMark)) // predefined very bottom value of in range
132130
}
133131

134132
private fun iobCob(bundle: Bundle) {

plugins/sync/src/main/kotlin/app/aaps/plugins/sync/wear/wearintegration/DataHandlerMobile.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,10 +1331,8 @@ class DataHandlerMobile @Inject constructor(
13311331
timeStamp = bg.timestamp,
13321332
glucoseUnits = GlucoseUnit.MGDL.asText,
13331333
sgv = bg.value,
1334-
veryHigh = 0.0,
13351334
high = 0.0,
13361335
low = 0.0,
1337-
veryLow = 0.0,
13381336
color = predictionColor(context, bg)
13391337
)
13401338
)
@@ -1468,10 +1466,8 @@ class DataHandlerMobile @Inject constructor(
14681466
private fun getSingleBG(glucoseValue: InMemoryGlucoseValue): EventData.SingleBg {
14691467
val glucoseStatus = glucoseStatusProvider.getGlucoseStatusData(true)
14701468
val units = profileFunction.getUnits()
1471-
val veryLowLine = profileUtil.convertToMgdl(preferences.get(UnitDoubleKey.OverviewVeryLowMark), units)
14721469
val lowLine = profileUtil.convertToMgdl(preferences.get(UnitDoubleKey.OverviewLowMark), units)
14731470
val highLine = profileUtil.convertToMgdl(preferences.get(UnitDoubleKey.OverviewHighMark), units)
1474-
val veryHighLine = profileUtil.convertToMgdl(preferences.get(UnitDoubleKey.OverviewVeryHighMark), units)
14751471

14761472
return EventData.SingleBg(
14771473
dataset = 0,
@@ -1485,10 +1481,8 @@ class DataHandlerMobile @Inject constructor(
14851481
avgDeltaDetailed = glucoseStatus?.let { deltaStringDetailed(it.shortAvgDelta, it.shortAvgDelta * Constants.MGDL_TO_MMOLL, units) } ?: "--",
14861482
sgvLevel = if (glucoseValue.recalculated > highLine) 1L else if (glucoseValue.recalculated < lowLine) -1L else 0L,
14871483
sgv = glucoseValue.recalculated,
1488-
veryHigh = veryHighLine,
14891484
high = highLine,
14901485
low = lowLine,
1491-
veryLow = veryLowLine,
14921486
color = 0,
14931487
deltaMgdl = glucoseStatus?.delta,
14941488
avgDeltaMgdl = glucoseStatus?.shortAvgDelta

plugins/sync/src/test/kotlin/app/aaps/plugins/sync/tizen/TizenPluginTest.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,8 @@ internal class TizenPluginTest : TestBaseWithProfile() {
8282
assertThat(bundle.containsKey("slopeArrow")).isTrue()
8383
assertThat(bundle.containsKey("deltaMgdl")).isTrue()
8484
assertThat(bundle.containsKey("avgDeltaMgdl")).isTrue()
85-
assertThat(bundle.containsKey("veryHigh")).isTrue()
8685
assertThat(bundle.containsKey("high")).isTrue()
8786
assertThat(bundle.containsKey("low")).isTrue()
88-
assertThat(bundle.containsKey("veryLow")).isTrue()
8987
assertThat(bundle.containsKey("bolusIob")).isTrue()
9088
assertThat(bundle.containsKey("basalIob")).isTrue()
9189
assertThat(bundle.containsKey("iob")).isTrue()

wear/src/main/kotlin/app/aaps/wear/data/RawDisplayData.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ class RawDisplayData {
2727
avgDeltaDetailed = "--",
2828
sgvLevel = 0,
2929
sgv = 0.0,
30-
veryHigh = 0.0,
3130
high = 0.0,
3231
low = 0.0,
33-
veryLow = 0.0,
3432
color = 0,
3533
deltaMgdl = null,
3634
avgDeltaMgdl = null
@@ -46,10 +44,8 @@ class RawDisplayData {
4644
avgDeltaDetailed = "--",
4745
sgvLevel = 0,
4846
sgv = 0.0,
49-
veryHigh = 0.0,
5047
high = 0.0,
5148
low = 0.0,
52-
veryLow = 0.0,
5349
color = 0,
5450
deltaMgdl = null,
5551
avgDeltaMgdl = null,
@@ -65,10 +61,8 @@ class RawDisplayData {
6561
avgDeltaDetailed = "--",
6662
sgvLevel = 0,
6763
sgv = 0.0,
68-
veryHigh = 0.0,
6964
high = 0.0,
7065
low = 0.0,
71-
veryLow = 0.0,
7266
color = 0,
7367
deltaMgdl = null,
7468
avgDeltaMgdl = null,

wear/src/main/kotlin/app/aaps/wear/watchfaces/CircleWatchface.kt

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -253,16 +253,11 @@ class CircleWatchface : WatchFace() {
253253
angleBig = ((hour + minute / 60f) / 12f * 360 - 90 - BIG_HAND_WIDTH / 2f + 360) % 360
254254
angleSMALL = (minute / 60f * 360 - 90 - SMALL_HAND_WIDTH / 2f + 360) % 360
255255
color = 0
256-
257-
val entry = singleBg[0];
258-
color = when {
259-
entry.sgv >= entry.veryHigh -> veryHighColor
260-
entry.sgv >= entry.high -> highColor
261-
entry.sgv <= entry.veryLow -> veryLowColor
262-
entry.sgv <= entry.low -> lowColor
263-
else -> inRangeColor
256+
when (singleBg[0].sgvLevel.toInt()) {
257+
-1 -> color = lowColor
258+
0 -> color = inRangeColor
259+
1 -> color = highColor
264260
}
265-
266261
circlePaint.shader = null
267262
circlePaint.style = Paint.Style.STROKE
268263
circlePaint.strokeWidth = CIRCLE_WIDTH
@@ -297,16 +292,12 @@ class CircleWatchface : WatchFace() {
297292
}
298293

299294
// defining color for dark and bright
300-
private val veryLowColor: Int
301-
get() = if (sp.getBoolean(R.string.key_dark, true)) Color.argb(255, 255, 120, 120) else Color.argb(255, 255, 80, 80)
302295
private val lowColor: Int
303-
get() = if (sp.getBoolean(R.string.key_dark, true)) Color.argb(255, 255, 255, 120) else Color.argb(255, 255, 80, 80)
296+
get() = if (sp.getBoolean(R.string.key_dark, true)) Color.argb(255, 255, 120, 120) else Color.argb(255, 255, 80, 80)
304297
private val inRangeColor: Int
305298
get() = if (sp.getBoolean(R.string.key_dark, true)) Color.argb(255, 120, 255, 120) else Color.argb(255, 0, 240, 0)
306299
private val highColor: Int
307300
get() = if (sp.getBoolean(R.string.key_dark, true)) Color.argb(255, 255, 255, 120) else Color.argb(255, 255, 200, 0)
308-
private val veryHighColor: Int
309-
get() = if (sp.getBoolean(R.string.key_dark, true)) Color.argb(255, 255, 120, 120) else Color.argb(255, 255, 200, 0)
310301
private val backgroundColor: Int
311302
get() = if (sp.getBoolean(R.string.key_dark, true)) Color.BLACK else Color.WHITE
312303
val textColor: Int
@@ -318,10 +309,8 @@ class CircleWatchface : WatchFace() {
318309
//Perfect low and High indicators
319310
if (bgDataList.isNotEmpty()) {
320311
addIndicator(canvas, 100f, Color.LTGRAY)
321-
addIndicator(canvas, bgDataList.iterator().next().veryLow.toFloat(), veryLowColor)
322312
addIndicator(canvas, bgDataList.iterator().next().low.toFloat(), lowColor)
323313
addIndicator(canvas, bgDataList.iterator().next().high.toFloat(), highColor)
324-
addIndicator(canvas, bgDataList.iterator().next().veryHigh.toFloat(), veryHighColor)
325314
if (sp.getBoolean("softRingHistory", true)) {
326315
for (data in bgDataList) {
327316
addReadingSoft(canvas, data)
@@ -417,15 +406,9 @@ class CircleWatchface : WatchFace() {
417406
indicatorColor = Color.LTGRAY
418407
}
419408
var barColor = Color.GRAY
420-
if (entry.sgv >= entry.veryHigh) {
421-
indicatorColor = veryHighColor
422-
barColor = darken(veryHighColor)
423-
} else if (entry.sgv >= entry.high) {
409+
if (entry.sgv >= entry.high) {
424410
indicatorColor = highColor
425411
barColor = darken(highColor)
426-
} else if (entry.sgv <= entry.veryLow) {
427-
indicatorColor = veryLowColor
428-
barColor = darken(veryLowColor)
429412
} else if (entry.sgv <= entry.low) {
430413
indicatorColor = lowColor
431414
barColor = darken(lowColor)

wear/src/main/kotlin/app/aaps/wear/watchfaces/CustomWatchface.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,10 @@ class CustomWatchface : BaseWatchFace() {
7171
private var json = JSONObject()
7272
private var jsonString = ""
7373

74-
private fun bgColor(dataSet: Int): Int = when {
75-
singleBg[dataSet].sgv >= singleBg[dataSet].veryHigh -> veryHighColor
76-
singleBg[dataSet].sgv >= singleBg[dataSet].high -> highColor
77-
singleBg[dataSet].sgv <= singleBg[dataSet].veryLow -> veryLowColor
78-
singleBg[dataSet].sgv <= singleBg[dataSet].low -> lowColor
74+
private fun bgColor(dataSet: Int): Int = when (singleBg[dataSet].sgvLevel) {
75+
1L -> highColor
76+
0L -> midColor
77+
-1L -> lowColor
7978
else -> midColor
8079
}
8180

wear/src/main/kotlin/app/aaps/wear/watchfaces/DigitalStyleWatchface.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,12 @@ class DigitalStyleWatchface : BaseWatchFace() {
3636
}
3737

3838
override fun setColorDark() {
39-
val entry = singleBg[0]
40-
val color = when {
41-
entry.sgv >= entry.veryHigh -> R.color.dark_veryHighColor
42-
entry.sgv >= entry.high -> R.color.dark_highColor
43-
entry.sgv <= entry.veryLow -> R.color.dark_veryLowColor
44-
entry.sgv <= entry.low -> R.color.dark_lowColor
39+
val color = when (singleBg[0].sgvLevel) {
40+
1L -> R.color.dark_highColor
41+
0L -> R.color.dark_midColor
42+
-1L -> R.color.dark_lowColor
4543
else -> R.color.dark_midColor
4644
}
47-
4845
binding.sgv.setTextColor(ContextCompat.getColor(this, color))
4946
binding.direction.setTextColor(ContextCompat.getColor(this, color))
5047

wear/src/main/kotlin/app/aaps/wear/watchfaces/utils/BaseWatchFace.kt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,8 @@ abstract class BaseWatchFace : WatchFace() {
7373
var loopLevelExt2 = -1
7474
var enableExt1 = false
7575
var enableExt2 = false
76-
var veryHighColor = Color.RED
7776
var highColor = Color.YELLOW
78-
var lowColor = Color.YELLOW
79-
var veryLowColor = Color.RED
77+
var lowColor = Color.RED
8078
var midColor = Color.WHITE
8179
var gridColor = Color.WHITE
8280
var basalBackgroundColor = Color.BLUE
@@ -554,14 +552,12 @@ abstract class BaseWatchFace : WatchFace() {
554552
if (lowResMode)
555553
BgGraphBuilder(
556554
sp, dateUtil, graphData.entries, treatmentData.predictions, treatmentData.temps, treatmentData.basals, treatmentData.boluses, pointSize,
557-
midColor, gridColor,
558-
basalBackgroundColor, basalCenterColor, bolusColor, carbColor, timeframe
555+
midColor, gridColor, basalBackgroundColor, basalCenterColor, bolusColor, carbColor, timeframe
559556
)
560557
else
561558
BgGraphBuilder(
562-
sp, dateUtil, graphData.entries, treatmentData.predictions, treatmentData.temps, treatmentData.basals, treatmentData.boluses, pointSize,
563-
veryHighColor, highColor, lowColor, veryLowColor, midColor, gridColor,
564-
basalBackgroundColor, basalCenterColor, bolusColor, carbColor, timeframe
559+
sp, dateUtil, graphData.entries, treatmentData.predictions, treatmentData.temps, treatmentData.basals, treatmentData.boluses,
560+
pointSize, highColor, lowColor, midColor, gridColor, basalBackgroundColor, basalCenterColor, bolusColor, carbColor, timeframe
565561
)
566562
binding.chart?.lineChartData = bgGraphBuilder.lineData()
567563
binding.chart?.isViewportCalculationEnabled = true

0 commit comments

Comments
 (0)