Skip to content

Commit 5aaf666

Browse files
1.0.1: fix light mode, add screenshots
With a language picked in the settings, the widget kept the light/dark mode it started in, so on a light phone it drew white text on light glass. It now renders from the application context and redraws as soon as the theme switches. The line is also softer in light mode, so its blurred part reads as a shadow rather than a smudge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 685057e commit 5aaf666

11 files changed

Lines changed: 24 additions & 5 deletions

File tree

‎README.md‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,18 @@
22

33
A tiny Android app that shows your glucose from **Nightscout** as a glass-style home screen widget, a persistent notification and a number in the status bar. Nothing else.
44

5-
<!-- screenshots: add widget (light and dark), home screen and notification to docs/ and link them here -->
5+
<p align="center">
6+
<img src="docs/widget-dark.jpg" width="380" alt="Widget in dark mode, 101 steady, over a blurred 3-hour line and a green glow">
7+
<img src="docs/widget-light.jpg" width="380" alt="The same widget in light mode">
8+
</p>
9+
<p align="center">
10+
<img src="docs/status-bar.jpg" width="380" alt="Glucose value next to the clock in the status bar">
11+
<img src="docs/notification.jpg" width="380" alt="Persistent notification: 133, rising, +6, 1 min ago">
12+
</p>
13+
<p align="center">
14+
<img src="docs/home.jpg" width="260" alt="App home: large value, trend and the last 3 hours">
15+
<img src="docs/settings.jpg" width="260" alt="Settings: Nightscout, units, ranges, glow intensity, language">
16+
</p>
617

718
## What it does
819

‎app/build.gradle‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ android {
1414
applicationId 'io.github.federicomameli1.sugarglass'
1515
minSdk 26
1616
targetSdk 34
17-
versionCode 1
18-
versionName '1.0.0'
17+
versionCode 2
18+
versionName '1.0.1'
1919
}
2020

2121
signingConfigs {

‎app/src/main/java/io/github/federicomameli1/sugarglass/GlucoseService.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ public void onCreate() {
141141
}
142142
}
143143

144+
@Override
145+
public void onConfigurationChanged(Configuration changed) {
146+
super.onConfigurationChanged(changed);
147+
GlucoseWidget.updateAll(this); // light/dark switched: the colours set from code have to follow now
148+
}
149+
144150
@Override
145151
public int onStartCommand(Intent intent, int flags, int startId) {
146152
handler.removeCallbacks(poll);

‎app/src/main/java/io/github/federicomameli1/sugarglass/GlucoseWidget.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ private static void update(Context context, AppWidgetManager manager, int[] ids)
4949
}
5050

5151
private static RemoteViews render(Context base, Bundle options) {
52-
Context context = GlucoseService.localized(base);
52+
// From the application context: it follows light/dark switches, while the service's own
53+
// localized context is a snapshot taken when it started
54+
Context context = GlucoseService.localized(base.getApplicationContext());
5355
// Portrait cell size: MIN_WIDTH is the portrait width, MAX_HEIGHT the portrait height
5456
int widthDp = Math.max(options.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH), 40);
5557
int heightDp = Math.max(options.getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT), 40);

‎app/src/main/res/values/colors.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<resources>
33
<color name="text_primary">#FF1C1C1E</color>
44
<color name="text_secondary">#991C1C1E</color>
5-
<color name="line">#D91C1C1E</color>
5+
<color name="line">#8C1C1C1E</color>
66
<color name="background">#FFF2F2F7</color>
77
<color name="range_ok">#FF34C759</color>
88
<color name="range_warn">#FFFF9F0A</color>

‎docs/home.jpg‎

40 KB
Loading

‎docs/notification.jpg‎

17.3 KB
Loading

‎docs/settings.jpg‎

70.4 KB
Loading

‎docs/status-bar.jpg‎

4.61 KB
Loading

‎docs/widget-dark.jpg‎

21.4 KB
Loading

0 commit comments

Comments
 (0)