Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [Unreleased]

## [1.2.9] - 2026-09-12

### Removed

- The trend arrow image beside the reading is gone. The Android for Cars guidelines permit a single static image for content context on the car screen, and the arrow was a second image alongside the graph — Google Play rejected version code 11 on that basis. The graph is now the only image on the screen at any time, and it sits in the background image slot the guideline designates for exactly that purpose. Which way the glucose is going still reads from the delta beside the reading and from the graph itself

### Changed

- The graph no longer labels individual readings with value bubbles, so it shows the shape of the last three hours rather than a row of numbers to read while driving. The reading, the delta, the trend line and its colours, the target range band and the time and value axes are all unchanged
- The graph is now held as one fixed image for five minutes at a time and is never animated or continuously updated, in the way album art stays put for the length of a track. It used to be redrawn whenever new readings arrived, which for sources that upload faster than sensor cadence could mean once a minute. The reading, the delta and the timestamps beside the graph are text and still update as soon as new data arrives, so nothing about how quickly a new value reaches the screen has changed

## [1.2.8] - 2026-09-08

### Removed
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
applicationId = "de.autosugar"
minSdk = 26
targetSdk = 37
versionCode = 13
versionName = "1.2.8"
versionCode = 14
versionName = "1.2.9"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

Expand Down
22 changes: 18 additions & 4 deletions app/src/main/java/de/autosugar/car/GlucoseGraphRenderer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ import de.autosugar.data.model.MG_DL_PER_MMOL_L
import java.util.Locale
import kotlin.math.roundToInt

/**
* Whether the value bubbles along the trace are drawn.
*
* Off since Google Play rejected version code 11 under the Android for Cars "images on
* screen" guideline, which permits only a single static image for content context. The
* numeric bubbles are the part of the graph that reads as a data display rather than
* content context, and they are also the most to parse at a glance while driving. The
* drawing code below is deliberately kept so they can be switched back on if the guideline
* or its reading changes — flip this to `true`.
*/
private const val DROP_PINS_ENABLED = false

/**
* Renders the 3-hour glucose history graph as a [CarIcon] bitmap.
*
Expand Down Expand Up @@ -212,10 +224,12 @@ private fun drawDropPinsAndHourLines(
)
}

val closest = entries.minByOrNull { kotlin.math.abs(it.dateMs - t) }
if (closest != null) {
drawDropPin(canvas, closest, unit, x, dropFill, dropText, dropBodyW, dropBodyH,
dropCorner, dropTailW, dropTailH, minTipY, yOf, colorOf)
if (DROP_PINS_ENABLED) {
val closest = entries.minByOrNull { kotlin.math.abs(it.dateMs - t) }
if (closest != null) {
drawDropPin(canvas, closest, unit, x, dropFill, dropText, dropBodyW, dropBodyH,
dropCorner, dropTailW, dropTailH, minTipY, yOf, colorOf)
}
}

t += ms20
Expand Down
54 changes: 43 additions & 11 deletions app/src/main/java/de/autosugar/car/GlucoseScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch

/**
* Whether the trend arrow is drawn next to the reading.
*
* Off since Google Play rejected version code 11 under the Android for Cars "images on
* screen" guideline, which permits only a single static image for content context. The
* graph occupies that one slot, so the arrow was a second image on the same screen. The
* arrow itself and [trendArrowIcon] are deliberately kept so it can be switched back on if
* the guideline or its reading changes — flip this to `true`.
*/
private const val TREND_ARROW_ENABLED = false

/**
* Shortest interval at which the graph image may be redrawn.
*
* The graph is the one image the Android for Cars guidelines allow on the car screen, and
* they allow it as a *static* image for content context. Holding the bitmap for five
* minutes keeps that true no matter how fast the source reports: readings normally arrive
* at sensor cadence, but some uploaders push every minute, which would otherwise redraw the
* image on every poll and turn it into a live view. The reading, delta and timestamps
* beside it are text and keep updating as soon as data arrives.
*/
private const val MIN_GRAPH_REDRAW_MS = 5 * 60_000L

class GlucoseScreen(
carContext: CarContext,
private val repository: NightscoutRepository,
Expand Down Expand Up @@ -68,6 +91,7 @@ class GlucoseScreen(
)
private var cachedGraphKey: GraphCacheKey? = null
private var cachedGraphIcon: CarIcon? = null
private var lastGraphRenderMs = 0L

// onGetTemplate can fire frequently; cache the small generated bitmaps so they are
// not re-rendered on the main thread on every rebuild.
Expand Down Expand Up @@ -292,17 +316,17 @@ class GlucoseScreen(
} else if (lastFetchedMs > 0) {
statsRow.addText(carContext.getString(R.string.label_received, ageString(now - lastFetchedMs)))
}
val pane = Pane.Builder()
.addRow(
Row.Builder()
.setTitle("${e.displayValue(unit)} ${unitLabel(unit)}")
.setImage(
trendIconCache.getOrPut(e.direction) { trendArrowIcon(e.direction) },
Row.IMAGE_TYPE_LARGE,
)
.addText("${e.displayDelta(unit) ?: "-"} ${unitLabel(unit)}")
.build()
val valueRow = Row.Builder()
.setTitle("${e.displayValue(unit)} ${unitLabel(unit)}")
.addText("${e.displayDelta(unit) ?: "-"} ${unitLabel(unit)}")
if (TREND_ARROW_ENABLED) {
valueRow.setImage(
trendIconCache.getOrPut(e.direction) { trendArrowIcon(e.direction) },
Row.IMAGE_TYPE_LARGE,
)
}
val pane = Pane.Builder()
.addRow(valueRow.build())
.addRow(statsRow.build())
if (errorMessage != null) {
pane.addAction(
Expand All @@ -322,11 +346,18 @@ class GlucoseScreen(
bgLow = thresholds.bgLow,
bgHigh = thresholds.bgHigh,
)
if (cachedGraphKey != key) {
// Draw immediately when there is nothing on screen yet (first reading, or a
// profile switch); otherwise hold the current image for MIN_GRAPH_REDRAW_MS even
// if newer readings have arrived. The stale key is kept, not overwritten, so the
// next rebuild after the hold expires picks the newer data up.
if (cachedGraphIcon == null ||
(cachedGraphKey != key && now - lastGraphRenderMs >= MIN_GRAPH_REDRAW_MS)
) {
cachedGraphIcon = glucoseGraphIcon(
history, unit, key.bgTargetBottom, key.bgTargetTop, key.bgLow, key.bgHigh,
)
cachedGraphKey = key
lastGraphRenderMs = now
}
pane.setImage(cachedGraphIcon!!)
}
Expand Down Expand Up @@ -363,6 +394,7 @@ class GlucoseScreen(
isLoading = true
cachedGraphKey = null
cachedGraphIcon = null
lastGraphRenderMs = 0L
invalidate()
lifecycleScope.launch { fetch() }
}
Expand Down
1 change: 1 addition & 0 deletions docs/whatsnew/1.2.9-ar
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
تعرض شاشة السيارة الآن صورة ثابتة واحدة فقط، وفق إرشادات Android Auto. أُزيل سهم الاتجاه بجانب القراءة، ولم يعد الرسم البياني يضع قيمة لكل قراءة. يبقى الرسم البياني ثابتًا خمس دقائق، بينما تستمر القراءة والفارق والأوقات في التحديث فورًا.
1 change: 1 addition & 0 deletions docs/whatsnew/1.2.9-de-DE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Der Autobildschirm zeigt jetzt nur noch ein einziges, statisches Bild, wie es die Android-Auto-Richtlinien verlangen. Der Trendpfeil neben dem Wert entfällt, und die Grafik beschriftet einzelne Messwerte nicht mehr. Die Grafik bleibt jeweils fünf Minuten stehen; Wert, Änderung und Zeiten aktualisieren sich weiterhin sofort.
1 change: 1 addition & 0 deletions docs/whatsnew/1.2.9-en-US
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The car screen now shows a single, static image, as the Android Auto guidelines require. The trend arrow beside the reading is gone, and the graph no longer labels each reading with a value. The graph now holds for five minutes at a time; the reading, change and times still update right away.
1 change: 1 addition & 0 deletions docs/whatsnew/1.2.9-es-ES
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
La pantalla del coche ahora muestra una sola imagen estática, como exigen las normas de Android Auto. Desaparece la flecha de tendencia junto al valor y el gráfico ya no etiqueta cada lectura. El gráfico se mantiene fijo cinco minutos; el valor, la variación y las horas se siguen actualizando al instante.
1 change: 1 addition & 0 deletions docs/whatsnew/1.2.9-fr-FR
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
L'écran de la voiture n'affiche plus qu'une seule image statique, comme l'exigent les règles d'Android Auto. La flèche de tendance à côté de la valeur disparaît et le graphique n'étiquette plus chaque mesure. Le graphique reste fixe pendant cinq minutes ; la valeur, l'écart et les horaires se mettent toujours à jour immédiatement.
1 change: 1 addition & 0 deletions docs/whatsnew/1.2.9-hi-IN
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
कार स्क्रीन अब केवल एक स्थिर छवि दिखाती है, जैसा Android Auto के दिशानिर्देश कहते हैं। रीडिंग के बगल का ट्रेंड तीर हटा दिया गया है और ग्राफ़ अब हर रीडिंग पर मान नहीं दिखाता। ग्राफ़ पाँच मिनट तक स्थिर रहता है; रीडिंग, बदलाव और समय पहले की तरह तुरंत अपडेट होते हैं।
1 change: 1 addition & 0 deletions docs/whatsnew/1.2.9-it-IT
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
La schermata dell'auto ora mostra una sola immagine statica, come richiedono le linee guida di Android Auto. La freccia di tendenza accanto al valore non c'è più e il grafico non etichetta più ogni lettura. Il grafico resta fermo per cinque minuti; valore, variazione e orari si aggiornano sempre subito.
1 change: 1 addition & 0 deletions docs/whatsnew/1.2.9-ja-JP
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Android Auto のガイドラインに合わせ、車の画面に表示される画像は静止画1点のみになりました。数値の横のトレンド矢印は廃止し、グラフも各測定値のラベル表示をやめました。グラフは5分ごとの更新になりますが、数値・変化量・時刻はこれまでどおりすぐに更新されます。
1 change: 1 addition & 0 deletions docs/whatsnew/1.2.9-nl-NL
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Het autoscherm toont nu nog maar één statische afbeelding, zoals de richtlijnen van Android Auto vereisen. De trendpijl naast de waarde is weg en de grafiek labelt niet langer elke meting. De grafiek blijft vijf minuten staan; waarde, verschil en tijden worden nog steeds direct bijgewerkt.
1 change: 1 addition & 0 deletions docs/whatsnew/1.2.9-pt-PT
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
O ecrã do carro mostra agora apenas uma imagem estática, como exigem as regras do Android Auto. A seta de tendência ao lado do valor desapareceu e o gráfico já não identifica cada leitura. O gráfico mantém-se fixo durante cinco minutos; o valor, a variação e as horas continuam a atualizar de imediato.
1 change: 1 addition & 0 deletions docs/whatsnew/1.2.9-zh-CN
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
为符合 Android Auto 指南,车机屏幕现在只显示一张静态图片。读数旁的趋势箭头已移除,图表也不再标注每个读数的数值。图表每五分钟才更新一次;读数、变化量和时间仍会立即更新。
Loading