feat(train): recording a workout on Android (ADR 0030, D13, D16, D19, D21)

RecorderService, a foreground service of the types location and health
started from the open app, takes fixes from LocationManager's GPS and
steps from the step detector, pauses by itself (AutoPause, tested on the
JVM) and appends each sample to the person's recording file, flushed
every five seconds. MainActivity asks for location, notifications and,
for auto-pause on foot, physical activity, never background location
(D19), and bridges the service to the app.

The app follows the file's lines with RecordingBloc and shows the moving
time, the distance, the pace or speed and GPS's state; the notification
shows the time and the distance with Pause or Resume. Stop is held down;
a stopped recording is saved as a workout and its series, or discarded
after asking, and one cut off or left unsaved is offered as the app
opens. Home has the Record button where the device records.

Three choices of the implementation's are recorded under D21 for review:
rowing waits for 5f, auto-pause on foot without steps goes by GPS speed
(below 2 km/h, on above 3 km/h), and Stop's hint shows above the button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-28 13:24:56 +01:00
commit 7df1cb1740
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64
5 changed files with 3360 additions and 27 deletions

View file

@ -12,5 +12,45 @@
"accountTitle": "Konto",
"accountDeleteMessage": "Dein Konto wird auf dem Server und auf all deinen Geräten gelöscht. Dies kann nicht rückgängig gemacht werden.",
"aboutTitle": "Über"
"aboutTitle": "Über",
"homeRecordHint": "Zeichne mit dem Knopf unten ein Training auf. Die Liste deiner Trainings kommt mit der nächsten Version von Halkyon Train.",
"recordAction": "Aufzeichnen",
"recordBack": "Zurück zur Aufzeichnung",
"recordSheetTitle": "Training aufzeichnen",
"activityRunning": "Laufen",
"activityWalking": "Gehen",
"activityHiking": "Wandern",
"activityCycling": "Radfahren",
"activityIndoorRowing": "Rudern drinnen",
"recordAutoPause": "Von selbst pausieren",
"recordAutoPauseHint": "Wenn du stehst, und weiter, sobald du dich wieder bewegst",
"recordStart": "Start",
"recordLocationRefused": "Train braucht deinen Standort, um das aufzuzeichnen. Du kannst ihn in den Einstellungen des Systems erlauben.",
"recordingWaitingForGps": "Warte auf GPS",
"recordingWaitingForGpsAccuracy": "Warte auf GPS · ±{metres} m",
"recordingGpsAccuracy": "GPS ±{metres} m",
"recordingMovingTime": "Zeit in Bewegung",
"recordingDistance": "Strecke",
"recordingPace": "Tempo",
"recordingSpeed": "Geschwindigkeit",
"recordingDistanceValue": "{km} km",
"recordingPaceValue": "{pace} /km",
"recordingSpeedValue": "{kmh} km/h",
"recordingPausedAuto": "Pausiert: keine Bewegung",
"recordingPausedByHand": "Pausiert",
"recordingPause": "Pause",
"recordingResume": "Weiter",
"recordingStop": "Stopp",
"recordingHoldToStop": "Halte Stopp gedrückt, um das Training zu beenden",
"recordingStoppedTitle": "Dieses Training speichern?",
"recordingSave": "Speichern",
"recordingDiscard": "Verwerfen",
"recordingDiscardTitle": "Dieses Training verwerfen?",
"recordingDiscardMessage": "Seine Zeit und Strecke werden von diesem Gerät gelöscht. Dies kann nicht rückgängig gemacht werden.",
"recordingSaveFailed": "Es kann auf diesem Gerät nicht gespeichert werden, da es die Schlüssel deines Kontos nicht hat. Es bleibt hier, bis es gespeichert werden kann.",
"recordingCutOffTitle": "Eine Aufzeichnung wurde abgebrochen",
"recordingCutOffMessage": "Eine Aufzeichnung von {start} wurde abgebrochen. Bis {end} speichern oder verwerfen?",
"recordingNotificationChannel": "Aufzeichnung",
"recordingNotificationPaused": "{activity} · pausiert"
}

View file

@ -14,5 +14,56 @@
"accountTitle": "Account",
"accountDeleteMessage": "Your account is deleted on the server and on all your devices. This can't be undone.",
"aboutTitle": "About"
"aboutTitle": "About",
"homeRecordHint": "Record a workout with the button below. The list of your workouts comes with the next version of Halkyon Train.",
"recordAction": "Record",
"recordBack": "Back to the recording",
"recordSheetTitle": "Record a workout",
"activityRunning": "Running",
"activityWalking": "Walking",
"activityHiking": "Hiking",
"activityCycling": "Cycling",
"activityIndoorRowing": "Rowing indoors",
"recordAutoPause": "Pause by itself",
"@recordAutoPause": {"description": "The switch for auto-pause, as the recording starts."},
"recordAutoPauseHint": "When you stand still, and going on as you move again",
"recordStart": "Start",
"recordLocationRefused": "Train needs your location to record this. You can allow it in the system's settings.",
"recordingWaitingForGps": "Waiting for GPS",
"recordingWaitingForGpsAccuracy": "Waiting for GPS · ±{metres} m",
"@recordingWaitingForGpsAccuracy": {"description": "Before a fix precise enough: how far off the last one may be.", "placeholders": {"metres": {"type": "int"}}},
"recordingGpsAccuracy": "GPS ±{metres} m",
"@recordingGpsAccuracy": {"description": "How far off the last fix may be.", "placeholders": {"metres": {"type": "int"}}},
"recordingMovingTime": "moving time",
"@recordingMovingTime": {"description": "Under the time, lower case: the time moved, pauses left out."},
"recordingDistance": "distance",
"recordingPace": "pace",
"recordingSpeed": "speed",
"recordingDistanceValue": "{km} km",
"@recordingDistanceValue": {"placeholders": {"km": {"type": "String", "example": "5.12"}}},
"recordingPaceValue": "{pace} /km",
"@recordingPaceValue": {"description": "Minutes and seconds a kilometre takes.", "placeholders": {"pace": {"type": "String", "example": "6:18"}}},
"recordingSpeedValue": "{kmh} km/h",
"@recordingSpeedValue": {"placeholders": {"kmh": {"type": "String", "example": "24.3"}}},
"recordingPausedAuto": "Paused: not moving",
"@recordingPausedAuto": {"description": "Train paused the recording by itself (auto-pause)."},
"recordingPausedByHand": "Paused",
"recordingPause": "Pause",
"recordingResume": "Resume",
"recordingStop": "Stop",
"recordingHoldToStop": "Hold Stop to end the workout",
"recordingStoppedTitle": "Save this workout?",
"recordingSave": "Save",
"recordingDiscard": "Discard",
"recordingDiscardTitle": "Discard this workout?",
"recordingDiscardMessage": "Its time and track are deleted from this device. This can't be undone.",
"recordingSaveFailed": "It can't be saved on this device, which doesn't hold your account's keys. It stays here until it can be.",
"recordingCutOffTitle": "A recording was cut off",
"recordingCutOffMessage": "A recording from {start} was cut off. Save it up to {end}, or discard it?",
"@recordingCutOffMessage": {"description": "A recording found unfinished as the app opened: when it started and its last sample.", "placeholders": {"start": {"type": "String", "example": "07:30"}, "end": {"type": "String", "example": "08:02"}}},
"recordingNotificationChannel": "Recording",
"@recordingNotificationChannel": {"description": "The name of the recording's notification channel, in the system's settings."},
"recordingNotificationPaused": "{activity} · paused",
"@recordingNotificationPaused": {"description": "The notification's title while paused.", "placeholders": {"activity": {"type": "String", "example": "Running"}}}
}

View file

@ -147,6 +147,240 @@ abstract class AppLocalizations {
/// In en, this message translates to:
/// **'About'**
String get aboutTitle;
/// No description provided for @homeRecordHint.
///
/// In en, this message translates to:
/// **'Record a workout with the button below. The list of your workouts comes with the next version of Halkyon Train.'**
String get homeRecordHint;
/// No description provided for @recordAction.
///
/// In en, this message translates to:
/// **'Record'**
String get recordAction;
/// No description provided for @recordBack.
///
/// In en, this message translates to:
/// **'Back to the recording'**
String get recordBack;
/// No description provided for @recordSheetTitle.
///
/// In en, this message translates to:
/// **'Record a workout'**
String get recordSheetTitle;
/// No description provided for @activityRunning.
///
/// In en, this message translates to:
/// **'Running'**
String get activityRunning;
/// No description provided for @activityWalking.
///
/// In en, this message translates to:
/// **'Walking'**
String get activityWalking;
/// No description provided for @activityHiking.
///
/// In en, this message translates to:
/// **'Hiking'**
String get activityHiking;
/// No description provided for @activityCycling.
///
/// In en, this message translates to:
/// **'Cycling'**
String get activityCycling;
/// No description provided for @activityIndoorRowing.
///
/// In en, this message translates to:
/// **'Rowing indoors'**
String get activityIndoorRowing;
/// The switch for auto-pause, as the recording starts.
///
/// In en, this message translates to:
/// **'Pause by itself'**
String get recordAutoPause;
/// No description provided for @recordAutoPauseHint.
///
/// In en, this message translates to:
/// **'When you stand still, and going on as you move again'**
String get recordAutoPauseHint;
/// No description provided for @recordStart.
///
/// In en, this message translates to:
/// **'Start'**
String get recordStart;
/// No description provided for @recordLocationRefused.
///
/// In en, this message translates to:
/// **'Train needs your location to record this. You can allow it in the system\'s settings.'**
String get recordLocationRefused;
/// No description provided for @recordingWaitingForGps.
///
/// In en, this message translates to:
/// **'Waiting for GPS'**
String get recordingWaitingForGps;
/// Before a fix precise enough: how far off the last one may be.
///
/// In en, this message translates to:
/// **'Waiting for GPS · ±{metres} m'**
String recordingWaitingForGpsAccuracy(int metres);
/// How far off the last fix may be.
///
/// In en, this message translates to:
/// **'GPS ±{metres} m'**
String recordingGpsAccuracy(int metres);
/// Under the time, lower case: the time moved, pauses left out.
///
/// In en, this message translates to:
/// **'moving time'**
String get recordingMovingTime;
/// No description provided for @recordingDistance.
///
/// In en, this message translates to:
/// **'distance'**
String get recordingDistance;
/// No description provided for @recordingPace.
///
/// In en, this message translates to:
/// **'pace'**
String get recordingPace;
/// No description provided for @recordingSpeed.
///
/// In en, this message translates to:
/// **'speed'**
String get recordingSpeed;
/// No description provided for @recordingDistanceValue.
///
/// In en, this message translates to:
/// **'{km} km'**
String recordingDistanceValue(String km);
/// Minutes and seconds a kilometre takes.
///
/// In en, this message translates to:
/// **'{pace} /km'**
String recordingPaceValue(String pace);
/// No description provided for @recordingSpeedValue.
///
/// In en, this message translates to:
/// **'{kmh} km/h'**
String recordingSpeedValue(String kmh);
/// Train paused the recording by itself (auto-pause).
///
/// In en, this message translates to:
/// **'Paused: not moving'**
String get recordingPausedAuto;
/// No description provided for @recordingPausedByHand.
///
/// In en, this message translates to:
/// **'Paused'**
String get recordingPausedByHand;
/// No description provided for @recordingPause.
///
/// In en, this message translates to:
/// **'Pause'**
String get recordingPause;
/// No description provided for @recordingResume.
///
/// In en, this message translates to:
/// **'Resume'**
String get recordingResume;
/// No description provided for @recordingStop.
///
/// In en, this message translates to:
/// **'Stop'**
String get recordingStop;
/// No description provided for @recordingHoldToStop.
///
/// In en, this message translates to:
/// **'Hold Stop to end the workout'**
String get recordingHoldToStop;
/// No description provided for @recordingStoppedTitle.
///
/// In en, this message translates to:
/// **'Save this workout?'**
String get recordingStoppedTitle;
/// No description provided for @recordingSave.
///
/// In en, this message translates to:
/// **'Save'**
String get recordingSave;
/// No description provided for @recordingDiscard.
///
/// In en, this message translates to:
/// **'Discard'**
String get recordingDiscard;
/// No description provided for @recordingDiscardTitle.
///
/// In en, this message translates to:
/// **'Discard this workout?'**
String get recordingDiscardTitle;
/// No description provided for @recordingDiscardMessage.
///
/// In en, this message translates to:
/// **'Its time and track are deleted from this device. This can\'t be undone.'**
String get recordingDiscardMessage;
/// No description provided for @recordingSaveFailed.
///
/// In en, this message translates to:
/// **'It can\'t be saved on this device, which doesn\'t hold your account\'s keys. It stays here until it can be.'**
String get recordingSaveFailed;
/// No description provided for @recordingCutOffTitle.
///
/// In en, this message translates to:
/// **'A recording was cut off'**
String get recordingCutOffTitle;
/// A recording found unfinished as the app opened: when it started and its last sample.
///
/// In en, this message translates to:
/// **'A recording from {start} was cut off. Save it up to {end}, or discard it?'**
String recordingCutOffMessage(String start, String end);
/// The name of the recording's notification channel, in the system's settings.
///
/// In en, this message translates to:
/// **'Recording'**
String get recordingNotificationChannel;
/// The notification's title while paused.
///
/// In en, this message translates to:
/// **'{activity} · paused'**
String recordingNotificationPaused(String activity);
}
class _AppLocalizationsDelegate

View file

@ -35,4 +35,141 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get aboutTitle => 'Über';
@override
String get homeRecordHint =>
'Zeichne mit dem Knopf unten ein Training auf. Die Liste deiner Trainings kommt mit der nächsten Version von Halkyon Train.';
@override
String get recordAction => 'Aufzeichnen';
@override
String get recordBack => 'Zurück zur Aufzeichnung';
@override
String get recordSheetTitle => 'Training aufzeichnen';
@override
String get activityRunning => 'Laufen';
@override
String get activityWalking => 'Gehen';
@override
String get activityHiking => 'Wandern';
@override
String get activityCycling => 'Radfahren';
@override
String get activityIndoorRowing => 'Rudern drinnen';
@override
String get recordAutoPause => 'Von selbst pausieren';
@override
String get recordAutoPauseHint =>
'Wenn du stehst, und weiter, sobald du dich wieder bewegst';
@override
String get recordStart => 'Start';
@override
String get recordLocationRefused =>
'Train braucht deinen Standort, um das aufzuzeichnen. Du kannst ihn in den Einstellungen des Systems erlauben.';
@override
String get recordingWaitingForGps => 'Warte auf GPS';
@override
String recordingWaitingForGpsAccuracy(int metres) {
return 'Warte auf GPS · ±$metres m';
}
@override
String recordingGpsAccuracy(int metres) {
return 'GPS ±$metres m';
}
@override
String get recordingMovingTime => 'Zeit in Bewegung';
@override
String get recordingDistance => 'Strecke';
@override
String get recordingPace => 'Tempo';
@override
String get recordingSpeed => 'Geschwindigkeit';
@override
String recordingDistanceValue(String km) {
return '$km km';
}
@override
String recordingPaceValue(String pace) {
return '$pace /km';
}
@override
String recordingSpeedValue(String kmh) {
return '$kmh km/h';
}
@override
String get recordingPausedAuto => 'Pausiert: keine Bewegung';
@override
String get recordingPausedByHand => 'Pausiert';
@override
String get recordingPause => 'Pause';
@override
String get recordingResume => 'Weiter';
@override
String get recordingStop => 'Stopp';
@override
String get recordingHoldToStop =>
'Halte Stopp gedrückt, um das Training zu beenden';
@override
String get recordingStoppedTitle => 'Dieses Training speichern?';
@override
String get recordingSave => 'Speichern';
@override
String get recordingDiscard => 'Verwerfen';
@override
String get recordingDiscardTitle => 'Dieses Training verwerfen?';
@override
String get recordingDiscardMessage =>
'Seine Zeit und Strecke werden von diesem Gerät gelöscht. Dies kann nicht rückgängig gemacht werden.';
@override
String get recordingSaveFailed =>
'Es kann auf diesem Gerät nicht gespeichert werden, da es die Schlüssel deines Kontos nicht hat. Es bleibt hier, bis es gespeichert werden kann.';
@override
String get recordingCutOffTitle => 'Eine Aufzeichnung wurde abgebrochen';
@override
String recordingCutOffMessage(String start, String end) {
return 'Eine Aufzeichnung von $start wurde abgebrochen. Bis $end speichern oder verwerfen?';
}
@override
String get recordingNotificationChannel => 'Aufzeichnung';
@override
String recordingNotificationPaused(String activity) {
return '$activity · pausiert';
}
}

View file

@ -35,6 +35,142 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get aboutTitle => 'About';
@override
String get homeRecordHint =>
'Record a workout with the button below. The list of your workouts comes with the next version of Halkyon Train.';
@override
String get recordAction => 'Record';
@override
String get recordBack => 'Back to the recording';
@override
String get recordSheetTitle => 'Record a workout';
@override
String get activityRunning => 'Running';
@override
String get activityWalking => 'Walking';
@override
String get activityHiking => 'Hiking';
@override
String get activityCycling => 'Cycling';
@override
String get activityIndoorRowing => 'Rowing indoors';
@override
String get recordAutoPause => 'Pause by itself';
@override
String get recordAutoPauseHint =>
'When you stand still, and going on as you move again';
@override
String get recordStart => 'Start';
@override
String get recordLocationRefused =>
'Train needs your location to record this. You can allow it in the system\'s settings.';
@override
String get recordingWaitingForGps => 'Waiting for GPS';
@override
String recordingWaitingForGpsAccuracy(int metres) {
return 'Waiting for GPS · ±$metres m';
}
@override
String recordingGpsAccuracy(int metres) {
return 'GPS ±$metres m';
}
@override
String get recordingMovingTime => 'moving time';
@override
String get recordingDistance => 'distance';
@override
String get recordingPace => 'pace';
@override
String get recordingSpeed => 'speed';
@override
String recordingDistanceValue(String km) {
return '$km km';
}
@override
String recordingPaceValue(String pace) {
return '$pace /km';
}
@override
String recordingSpeedValue(String kmh) {
return '$kmh km/h';
}
@override
String get recordingPausedAuto => 'Paused: not moving';
@override
String get recordingPausedByHand => 'Paused';
@override
String get recordingPause => 'Pause';
@override
String get recordingResume => 'Resume';
@override
String get recordingStop => 'Stop';
@override
String get recordingHoldToStop => 'Hold Stop to end the workout';
@override
String get recordingStoppedTitle => 'Save this workout?';
@override
String get recordingSave => 'Save';
@override
String get recordingDiscard => 'Discard';
@override
String get recordingDiscardTitle => 'Discard this workout?';
@override
String get recordingDiscardMessage =>
'Its time and track are deleted from this device. This can\'t be undone.';
@override
String get recordingSaveFailed =>
'It can\'t be saved on this device, which doesn\'t hold your account\'s keys. It stays here until it can be.';
@override
String get recordingCutOffTitle => 'A recording was cut off';
@override
String recordingCutOffMessage(String start, String end) {
return 'A recording from $start was cut off. Save it up to $end, or discard it?';
}
@override
String get recordingNotificationChannel => 'Recording';
@override
String recordingNotificationPaused(String activity) {
return '$activity · paused';
}
}
/// The translations for English, as used in the United Kingdom (`en_GB`).