feat(train): a workout's page as Strava's, maps readable and in the app's language, routes opening near the person (ADR 0030, D63)

- A workout with a track: its map to the foot of the screen under a sheet
  with its name; once the sheet settles, the map fits the track anew, eased,
  into what is left free; pulled up, the round buttons over the map fold
  into an app bar whose chevron lowers the sheet again. From expanded
  windows on, the map beside the rest. The page stays in Home but opens
  over the shell, without the floating bar.
- What the map's source sees moves behind a question mark.
- The map's credit on the app's theme: flutter_map's, built on
  flutter/material, never saw it (material_ui's Theme is a class of its
  own) and drew the theme's text on white; map_tiles read that Theme too,
  and so never chose the instance's dark map (D50).
- Places named in the app's language (name:<language>) where OpenFreeMap's
  styles ask for the English name.
- The route planner's hint behind a question mark; a new route's map opens
  at zoom 14 where the phone was last known to be, else where the newest
  workout with a track started; its details beside the map from expanded
  windows on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-03 22:02:06 +01:00
commit 3e90753b08
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64
2 changed files with 1518 additions and 358 deletions

View file

@ -109,6 +109,7 @@ class MainActivity : FlutterActivity() {
"show" -> result.success(RecorderService.show(call.arguments as String).let { null })
"isRecording" -> result.success(RecorderService.isRecording())
"position" -> position(result)
"lastPosition" -> result.success(lastPosition())
else -> result.notImplemented()
}
}
@ -279,6 +280,22 @@ class MainActivity : FlutterActivity() {
}
}
/** Where the phone was last known to be by any provider, the newest; none without the
* location permission, which this never asks for (ADR 0030, D63: a new route's map opens
* there at once). */
private fun lastPosition(): Map<String, Double>? {
if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED
) {
return null
}
val manager = getSystemService(LocationManager::class.java)
val newest = manager.getProviders(true)
.mapNotNull { manager.getLastKnownLocation(it) }
.maxByOrNull { it.time }
return newest?.let { mapOf("lat" to it.latitude, "lon" to it.longitude) }
}
private companion object {
const val RECORDER_REQUEST = 1
const val FRESH_MS = 120_000L