From 11d53e7bc7ae23e4004104d1bffc1342e3e1679a Mon Sep 17 00:00:00 2001 From: Nils Stinnesbeck Date: Sat, 17 Oct 2026 22:55:15 +0200 Subject: [PATCH] App 2.6.0: floating button to open the app The MG4's launcher does not list third-party apps, so the app could only be opened by reinstalling it. Now a small round MG-red button floats over the car's screens: tap opens the app, drag moves it (the position is kept and clamped to the screen), and it hides while the app itself is open. A switch in the Upload tab turns it off. The always-on service owns the overlay, so the button is there from boot. It needs the overlay permission (SYSTEM_ALERT_WINDOW), which the car build has through the system UID; without it, or if the window manager refuses, the button stays away and nothing crashes, and the Upload tab offers the system permission screen. Tested on an Android 9 AOSP emulator at the head unit's 1920x1080 / 160 dpi with the car APK (installs as UID 1000): button appears over the home screen, tap opens the app, hidden while open, drag moves it without opening the app, position survives a force-stop, the switch works through the UI. FloatingButtonGeometry has 3 unit tests. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01QLJfZQZeAKAwSqViTmLzki --- SPECS.md | 5 + app/build.gradle | 4 +- app/src/main/AndroidManifest.xml | 2 + .../com/evsuite/abrp/AbrpUploadService.java | 5 + .../java/com/evsuite/abrp/FloatingButton.java | 224 ++++++++++++++++++ .../evsuite/abrp/FloatingButtonGeometry.java | 31 +++ .../java/com/evsuite/abrp/MainActivity.java | 32 ++- .../java/com/evsuite/abrp/UploadSettings.java | 7 + .../main/res/layout-w1000dp/pane_service.xml | 6 + app/src/main/res/layout/pane_service.xml | 6 + app/src/main/res/values/strings.xml | 6 + .../abrp/FloatingButtonGeometryTest.java | 37 +++ 12 files changed, 362 insertions(+), 3 deletions(-) create mode 100644 app/src/main/java/com/evsuite/abrp/FloatingButton.java create mode 100644 app/src/main/java/com/evsuite/abrp/FloatingButtonGeometry.java create mode 100644 app/src/test/java/com/evsuite/abrp/FloatingButtonGeometryTest.java diff --git a/SPECS.md b/SPECS.md index 15496f6..f1bd1f5 100644 --- a/SPECS.md +++ b/SPECS.md @@ -114,6 +114,11 @@ tyre pressures, GPS (lat, lon, elevation, heading) and the is_* flags. It does * INGEST_TOKEN) into git and pushed it. Commit amended and force-pushed; both values regenerated in the now gitignored `k8s/secrets.yaml` (since moved to `k8s/secrets/secrets.yaml`, outside `kubectl apply -f k8s/`). Filled-in secrets live only there from now on. +- 2026-10-17 — App 2.6.0: floating button to open the app, because the MG4 launcher does not list + it. Drawn over other apps (needs the overlay permission, which the car build has through the + system UID), draggable, hidden while the app is open, switch in the Upload tab. Tested on an + Android 9 AOSP emulator at 1920x1080/160 dpi with the car APK (installs as UID 1000 there too). +- 2026-10-17 — App 2.5.0: range estimates at current and 5-minute average power (Vehicle tab). - 2026-10-17 — Live dashboard reworked around the signals the car sends: Climate setpoint, Last update and a computed Energy in pack replace the empty temperature tiles; Battery voltage and current replaces the Temperatures chart. diff --git a/app/build.gradle b/app/build.gradle index a04f404..0b35644 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -34,8 +34,8 @@ android { applicationId "com.stinnesbeck.nilsmg4" minSdk 27 targetSdk 36 - versionCode 62 - versionName "2.5.0" + versionCode 63 + versionName "2.6.0" // Nothing about the server ships in the APK: its URL and ingest token are entered in // the app's Server tab (ServerConfig), and the database is only reachable by the server. diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 36b8413..191f880 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,6 +13,8 @@ + +