MaksForge

Kozica

Android app

A hiking map of the Polish mountains that works with no signal at all.

Building

Phase 6d — The map keeps up

Sequence lives in PLAN.md; the live worklist lives in DOD.md. This phase relies on ADR-0008 (nothing reaches the network: the camera reads only the phone’s own fixes) and reopens two decisions of phase-6b.md, below. CONTEXT.md gains Course. No ADR: every decision here is cheap to reverse. Planned with the owner on 2026-11-29, after their first real hike.

What closing this phase means. Today the camera keeps the user in view only while Following, a pinch-zoom lets go of them, the map stays north up, and the dot’s arrow is the magnetometer’s. After this phase the camera keeps the user in view while Recording too, comes back by itself after a pan once they have walked on, turns the map to the way they are walking when they ask for it, and the map can take the whole screen. The difference a device can be asked about: during a recording, a pan followed by 15 s and 25 m of walking brings the camera back to the user with no tap, and with course-up on, a 90° turn on the walk turns the map within one fix of the user’s 20 m past the corner.

Why (the owner’s first real hike, 2026-11-29): they pocketed the phone, took it out, and the map was where they had left it with their pin off-screen; walking south on a north-up map “looks like I’m walking backwards”; with a Route chosen they could not get the map full screen.

What this overturns

  • Phase 6b’s “Not in: Heading-up”. The compass heading stays out, for 6b’s reason: near rock and steel it is off by tens of degrees. Course-up comes in, opt-in, from the Track’s own displacement rather than the magnetometer (§ 2), so it is as right as the fixes are. North up stays the default.
  • Phase 6b § 3’s camera paragraph. “While following the camera centres on the user at each fix, north up, until the user pans or zooms; the position button resumes it.” The camera now keeps up while Recording as well, a zoom no longer lets go, and it comes back by itself (§ 1).
  • The dot’s arrow. Phase 2 drew it from the magnetometer (RenderMode.COMPASS); it is now the Course, still in RenderMode.COMPASS, and no arrow at all when the user stands still (§ 3). Phase 2’s dot and accuracy circle are unchanged.

0. What this phase inherits

  • The camera is MapScreen’s: animateCamera to each fix while Following, padded so the user sits in the part of the map the search row and the banners leave open (phase 6b § 3). Any camera move with REASON_API_GESTURE, a pinch included, ends it.
  • The fixes. The map reads the phone’s own fixes once a second (positionFixes); the recorder reads its own every 5 s and keeps only those with an accuracy of 30 m or better.
  • The compass is MapLibre’s widget with our CompassDrawable; its tap turns the map north and offers no hook to learn that it did.

What is in, and what is deliberately not

In: the camera keeping up while Recording (not paused) or Following, coming back by itself, and letting a zoom through (§ 1); course-up, opt-in, on the position button (§ 2); the dot’s arrow from the Course (§ 3); the compass drawn by us so its tap can end course-up (§ 4); a full-screen map (§ 5).

Not in, and each with a reason rather than a phase:

  • The magnetometer, for the map or the dot. Phase 6b’s reason holds, and a Course needs no calibration figure-eight.
  • MapLibre’s own camera tracking (CameraMode.TRACKING_GPS). It drives the camera from the location component and lets go on any gesture of its own accord; our rules (§ 1) would be spent fighting it. The camera stays animateCamera/easeCamera, as in phase 6b.
  • A course-up arrow drawn on the map’s edge, or a tilted 3D view. A flat map turned to the Course is what the owner asked for; tilt hides what is ahead behind the relief.
  • Hiding the system bars in full screen. The clock and the battery matter on a long day, and an immersive mode costs a swipe to reach the notification’s Stop.

The tempting one: the camera keeping up whenever the dot is shown. It looks like one rule instead of two, but someone browsing the map at home with location on would have it pulled back at every fix. With neither Recording nor Following, only the position button moves the camera to the user.


Checkpoints

  Checkpoint Merges Depends on
A The camera keeps up, course-up, the dot and the compass (§ 1–4) feat: —
B Full screen (§ 5) feat: A

Two pull requests because they touch different files: A is MapScreen’s camera, B is the layout of Home, the Route sheet, the recording bar and the navigation bar, which Navigation.kt owns. No gate: nothing here depends on a platform behaviour nobody has measured.


1. The camera

MapScreen’s camera has three states, replacing phase 6b’s keepInView and centreWanted:

State The camera, at each fix while Recording (not paused) or Following Position button icon
Free stays where the user left it the outline target
Centred centres on the user, north up the filled target
Course-up puts the user at the lower third, the map turned to the Course the navigation arrow

With neither Recording nor Following (or while paused), a state other than Free moves the camera once, when it is chosen, and not at each fix. Beside the state the camera keeps when it was last made Free by a touch and where the user was then.

It turns on (to the last state the user chose, stored in AppPreferences, Centred until they choose course-up; Centred whatever was stored when location is approximate only) at: a position button tap; Record; Follow; and every return of the app to the foreground while Recording, paused or not, or Following, which jumps the camera at once. That last one alone fixes the pocket.

It turns off (Free) at a pan or a rotate gesture only, read from MapLibre’s addOnMoveListener and addOnRotateListener. A pinch is not a pan: a one-finger move lets go at once, a two-finger one only if the zoom did not change over it. While the camera keeps up, a pinch zooms about the user (UiSettings.setFocalPoint), so the dot stays where it is.

It comes back by itself only while Recording (not paused) or Following: 15 s after the last touch and once the user has moved 25 m from where they were at the pan. With neither, only the position button brings it back.

It holds — no move at a fix, no coming back — while a sheet is expanded, a Route is being edited (points on the map, not Following), a Trail or Bike route is selected or offered, a Hike is shown or a searched place is offered. Each of those moves the camera itself, and a fix must not undo it.

The position button cycles: Free → the last state chosen; Centred → Course-up; Course-up → Centred. With approximate location only, it is Centred from Free and Centred again from Centred.

Copy (content descriptions, saying what a tap does):

  • Free: “Show my position” (unchanged)
  • Centred: “Turn the map to my direction of travel”
  • Course-up: “Keep north up”

2. The Course

The Course is the bearing from the fix about 20 m back to the newest, over the fixes the Track would keep (accuracy 30 m or better): courseOf in ui/map/Course.kt, a pure function. The fixes it keeps are the newest one at least 20 m away and those of the last 60 s, so a user standing still keeps their last Course: it holds, it never drifts back to north, and an hour of standing keeps the list as short as a minute. A gap of more than 60 s between fixes starts the list over, so the last known fix the map is handed first, however old, never anchors a Course. While Recording, the Track’s points from the 60 s before the map’s newest fix that come before its first fix stand in front of its fixes, so a return from the background, when the map’s own fixes start over, keeps the Course. With no fix 20 m back there is no Course yet, and the camera keeps the bearing it has.

In course-up the camera turns only when the Course differs from the map’s bearing by 15° or more, along the shorter arc, in a 1 s ease, at most once per fix: GPS wobble on a straight path stays under 15° at 20 m. The user sits at the lower third of the map (a top padding of a third of its height), so what is ahead gets two thirds of the screen. Centred keeps phase 6b’s padding below the search row and the banners.

3. The dot

RenderMode.COMPASS, as in phase 2, while the user is moving: their last 20 m took under 60 s. The location component’s compassEngine is CourseCompassEngine in ui/map/, which reports the Course instead of the magnetometer, so the dot, the accuracy circle and the cone stay in phase 2’s tints and the cone points the way the user is going. Standing still, or with no Course yet, RenderMode.NORMAL: the dot and the circle, no cone. With approximate location only, NORMAL as before.

Not RenderMode.GPS, which looks like the fit: in MapLibre 13.7.1 it hides the accuracy circle and swaps the dot for a navigation puck, which breaks phase 2 § 4’s table.

4. The compass

Shown whenever the map’s bearing is not 0, under the overlay at the top end as before. MapLibre’s widget turns the map north on a tap but tells nobody, so the next fix in course-up would turn it back: the compass is now drawn in Compose from CompassDrawable, turned with the map. Its tap turns the map north and, from Course-up, makes the state Centred (stored as the last state chosen).

Copy: “Turn the map north” (content description).

5. Full screen (checkpoint B, the next pull request)

A full-screen button above the position button on Home, always shown. In full screen the NavigationBar, the search row and the Mode switch hide; the Route sheet becomes one ellipsised line (Following: the existing following_next line; otherwise the Route’s totals) that leaves full screen on a tap; the recording bar becomes one row (distance · time, pause, photo, stop). The Safety button, the warning banners, the off-Route banner and the © OpenStreetMap credit stay. System Back leaves full screen; the system bars stay. The flag is hoisted to Navigation.kt, which owns the recording bar and the navigation bar, and is not saved across process death.

Copy (content descriptions): “Show the map full screen” and “Leave full screen”; the latter is also the one line’s tap label.

Decided while building it (2026-11-29), where the above is silent:

  • The Safety button stays alone at the top end; Settings goes with the search row, and so do the search’s results. A searched place already offered, the download progress and the location banners stay.
  • The Record button stays beside the position button, so a recording starts without leaving full screen.
  • Only the Route sheet folds. A Trail, a Bike route, a chooser or a Hike opened by a tap on the map opens its sheet as usual: the tap asked for it.
  • The one line, in order: the Route cannot be planned → that line; one point → its name; being planned → the progress bar; Following with a leg back asked for → what the sheet says of it (the progress bar, following_back_no_way, or following_back_leg · the off-Trail distance); Following → following_next, or following_to_end once the next point is the end; a note after following ended → the note; otherwise the totals as “length · ↑ ascent · ↓ descent · time” (the walking time at the Pace, without the signposts’ time). Each progress bar tells TalkBack route_planning. routeLineShows in RouteSheet.kt, RouteLineTest. An expanded sheet folds too and stops holding the camera; it opens expanded again on leaving.
  • The one-row recording bar keeps its warnings (location off, notifications off) above the row, and the photos-left-out banner stays: they are warnings. With no recording the banner is the lowest thing, so it keeps clear of the system’s navigation. A Ride’s Bike chip goes with the title.
  • Full screen belongs to Home. Over Safety, the recording bar is whole again; Back to Home returns to full screen. The flag lives in a ViewModel, so a rotation keeps it and process death does not.
  • Entering full screen closes the keyboard, since the search field it belonged to is gone.

6. Landscape

Decided by the owner on 2026-12-05 after a design review. In landscape, Recording and Following, the stack left the map a strip of about 110 dp: the Junction card clipped, the off-Route banner never shown, the full-screen button under Settings, no room for the credit. The orientation stays unlocked.

  • The rule: usesSidePane in Navigation.kt, from the window’s size, not Home’s box (the keyboard shrinks that): under 480 dp tall and at least 600 dp wide. A short, narrow split-screen window keeps the stack. SidePaneTest.
  • The tabs become a NavigationRail at the start, on Routes and Outings too.
  • The map keeps the Junction card at the top start (its compact and tall rule unchanged), Safety, the full-screen and position buttons, Record when not recording, and the credit. The map gets narrower; nothing covers it. The full-screen button sits beside the position button, not above it, and both drop to their own line, at the end, where Record leaves them no room beside it.
  • The card moves to the pane only where the map cannot hold it whole above the bottom controls (pinsCardInPane, measured like portrait’s foldsRouteSheet): pinned at the pane’s top, above the banners. Of the readings in R6 that is 640 × 360 dp at font scale 2.0 alone.
  • A pane at the end, 340 dp or 45% of Home’s width, whichever is less, so a 640 dp window still fits the card beside Safety. Top to bottom: the off-Route banner, the location banners, the download progress, pinned and capped at two thirds of the pane; then the search row with Settings, the Mode switch, the search’s results, a searched place, and whichever sheet is shown, scrolling together, the search row giving way before a sheet’s own content scrolls; the recording bar at the bottom, one row while the distance and time fit beside its buttons, above them when they do not. While the keyboard is up the pane holds only the search row and its results.
  • The Route sheet never folds here (foldsRouteSheet is not asked); the pane has the room.
  • Full screen hides the rail and the search row and folds the Route sheet to its one line; the pane stays.
  • Elsewhere at that size the recording bar is one row at the bottom, beside the rail.
  • Portrait is unchanged.

Tests

  • CourseTest: no Course under 20 m; the bearing from the fix 20 m back, north, east, south and west; a fix worse than 30 m is not counted; standing still holds the last Course; moving against stopped by the 60 s rule; an old last-known fix is not counted; an hour standing still keeps the list bounded; walking on after a stop counts from where the user stood. Fails towards a map that turns on noise, or never turns.
  • CourseTest’s turn rule: under 15° no turn, at 15° a turn, across north (350° → 10°) by the shorter arc’s size.
  • FollowCameraTest: the come-back rule (15 s and 25 m both needed; never Free with neither Recording nor Following; never while held), the button’s cycle, approximate only, and a second pan keeping the first pan’s place and the newest time.
  • MapOrientationPreferenceTest: Centred (north up) on a phone that never chose; a choice sticks.

Documents this phase amends

  • phase-6b.md: Not in and § 3’s camera paragraph, each with a dated pointer here.
  • phase-2.md: the dot’s RenderMode.COMPASS line, with a dated pointer here.
  • PLAN.md: the status line and a section after phase 6c.
  • CONTEXT.md: Course.
  • store-listing.md: 0.23.0’s notes (A); B releases on its own, as 0.24.0, with its own notes.
  • No permission, no stored data beyond one preference: the privacy policy and play-app-content.md are unchanged.

Known gaps, deliberately

  • A switchback steeper than 20 m turns the map late, after the next 20 m. Shortening the baseline turns it on GPS wobble instead; the reading on a real hike decides.
  • The first 20 m of a walk have no Course, so course-up holds whatever bearing the map had.

Readings

PLAN.md rule 3. The emulator is enough for the camera’s rules: adb emu geo fix feeds the GPS provider the map and the recorder both read. A real walk decides the thresholds (DOD).

# Reading Command Result
R1 While Recording, the camera keeps up north up; with course-up chosen, a 90° turn turns the map; a stop holds the bearing adb emu geo fix steps, ≥ 10 fixes, a 90° turn and a stop; adb exec-out screencap -p Pass, 2026-11-29, emulators pixel-api37 (API 37) and pixel-api36 (API 36), -gpu host with a window, the debug build at 835b5aa, Recording a Hike from Kuźnice. Twelve fixes north 10 m apart: the dot holds its place while the map moves under it, north up, no compass. One tap on the position button chooses course-up; six fixes east turn the map, about 25° after two and east up by the third to sixth, the compass shown at about 90°. The last fix repeated for 24–26 s and none for 8 s more: the bearing holds, only the timer changes
R2 A pan lets go; the camera comes back 15 s after it once the user has walked 25 m, and not before the same, a pan by adb shell input swipe Pass, the same two emulators, in course-up. Under 25 m the camera stays away past 15 s (20 m at 22 s, 22.9 m at 18 s) and comes back at the first fix past 25 m (pixel-api37 at 24.2 s, 30 m; pixel-api36 back by 22.1 s, at the fix at 19.6 s, 33.4 m); under 15 s it stays away past 25 m (60 m at 14.4 s) and comes back at the first fix past 15 s (pixel-api37 at 16.6 s, 70 m). It comes back in course-up. The return lands on the first fix after both, so a 2 s fix rate places it to within 2 s
R3 Back to the foreground while Recording, the camera jumps to the user adb shell input keyevent KEYCODE_HOME, then the app’s launcher intent Pass, the same two emulators: a pan, Home, 6–7 m of fixes in the background (the recording took them), the launcher intent 7–8 s after the pan: the camera is on the user within a second, in course-up, under both 15 s and 25 m, so not the return. On pixel-api37 the dot’s direction cone was missing for three fixes after it, as if the Course were dropped on resume: a follow-up, not this reading’s. 2026-12-05, pixel-api37, -gpu host, Recording a Hike in Szczyrk: twelve fixes 3 m north 2 s apart, Home, five fixes of 1.4 m over 11 s, the launcher intent, five fixes of 3 m. main at 90ac549: the cone in the foreground, none at the return or any of the five fixes. With the fix: the cone at the return and at every fix after
R4 On a real hike: course-up turns at corners and not on a straight path; the pocket case the owner’s phone, a recorded Hike  
R5 Full screen (B) screenshots in Hiking, Following and Recording 2026-11-29, pixel-api37 (API 37, headless), Hiking. Home loses the tabs, the search row, Settings and the Mode switch; Safety stays alone at the top end, the full-screen button above the position button, the credit and the download banner stay. A planned Route folds to “0.9 km · ↑ 65 m · ↓ 1 m · 25 min”; Followed, to “Next: Boczań · 0.9 km · ↑ 63 m · 25 min”; Recording over it, one row “0 m · 4 sec” with pause, photo and stop. The line, the button and Back each leave it; Back from Safety returns to full screen, where Safety showed the whole recording bar. At 360 dp and font scale 1.3 the line ellipsises. That reading found the recording bar under the gesture handle wherever no tab bar is below it, Safety included before this phase: it now pads for the navigation bar there
R6 Landscape (§ 6) the debug Route receiver from Szczyrk, Follow, Record, adb emu geo fix off the Route; user_rotation 1; font scale 1.0, 1.3, 2.0; wm size 945x1680 Pass, 2026-12-05, pixel-api37, -gpu host with a window, Hiking and Cycling. At 800 × 360 dp the map is 450 × 335 dp beside an 80 dp rail and a 340 dp pane: the card whole at the top start, the off-Route banner whole at the pane’s top, the credit, the full-screen and position buttons clear of each other; the Route sheet, a tapped Trail’s sheet, a Ride’s sheet and the closed-Route bar in the pane, scrolled to with the search row giving way first; the recording bar one row at the bottom; the rail opens Routes and Outings, each with the one-row recording bar at the bottom. Full screen hides the rail and the search row and leaves the Route’s one line. At 1.3 the banner stays whole; at 2.0 its action shows and its last padding scrolls. At 640 × 360 dp the card stays whole beside Safety. The pane’s recording bar, re-read after review (headless): one row at 800 dp at 1.0 and 2.0, the distance and time above the buttons at 640 dp at 1.0 and 2.0, nothing ellipsised; the bottom bar’s one row on Routes unchanged. The map column re-read after review (headless, every pair of labelled bounds checked): at 800 and 640 dp, font scale 1.0, 1.3 and 2.0, Following with and without Recording, no control overlaps another and the credit stays whole; the card is on the map in every case but 640 dp at 2.0, where it sits at the pane’s top. Portrait: every node’s bounds identical to main’s in the same state

R1–R3 were not taken with checkpoint A’s pull request (2026-11-29): the owner’s phone joined adb over wireless debugging while pixel-api37 was booting, and device work stopped there by rule. They stay open in DOD.md; the unit tests cover the Course, the turn and the come-back rules.

Hi, I'm Maksymilian.

MaksForge is where I build the small tools I wish existed. Each one solves a single problem.