Skip to content

Add "Adapt to my typing" (adaptive key zones) – slim version from #676 - #680

Open
4di-hello wants to merge 1 commit into
LeanBitLab:mainfrom
4di-hello:feature/adaptive-touch
Open

4di-hello wants to merge 1 commit into
LeanBitLab:mainfrom
4di-hello:feature/adaptive-touch

Conversation

@4di-hello

Copy link
Copy Markdown
Contributor

As discussed in #676, this is the slimmer version of #671 for the 4.3.0 beta.

What it does

One switch in Text correction, off by default: "Adapt to my typing".

When on, the keyboard learns where the user touches each letter key, using the words that are finally committed as ground truth (autocorrected word, picked suggestion, reverted autocorrection, or a letter retyped after deleting a neighboring one). Once a key has 30 touches, a touch near the border to a neighboring key is assigned to the key the user most likely meant. The dictionary gets the corrected coordinates too, so autocorrection benefits as well. The shift is capped to a third of a key.

Your concerns from #671

  • One switch, fixed strength: no strength slider, no separate "collect data" switch.
  • Off = unchanged: with the switch off, nothing is recorded, nothing is loaded, and key detection runs the existing code path.
  • Determinism: same data, same key. It only differs from today near key borders and only after enough data.
  • Latency: per touch a few arithmetic operations on cached offsets, no I/O on the touch path.
  • Footprint in core: ~68 changed lines, only single hook calls:
    • KeyDetector (+3/-1), PointerTracker (+5/-1), InputLogic (+9)
    • settings key/default/value (+4), navigation entry (+6), Text correction screen (+10/-1)
    • backup category for the typing profile in BackupRestorePreference (+25/-3)
  • Everything else is in its own package latin/heatmap (TypingAdaptation, TypingHeatmap, KeyboardGeometry), plus the statistics screen and 17 unit tests.

Privacy

  • Never active in password fields or incognito mode, no gestures.
  • Stored only locally in no-backup storage (not in Android backups or device transfer). It only leaves the device in the keyboard's own backup, as a separate category.
  • Touches are stored per key without order, so text can't be reconstructed.

Statistics screen

Text correction → "Typing heatmap": heatmap per key, most frequent misses, misses per week and misses before/after adaptation. Easy to drop if you prefer.

Tests

  • TypingHeatmapTest: 17 tests, all pass.
  • InputLogicTest: only the 8 caps* failures (Robolectric DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION), which also fail on current main.
  • In daily use on my device for several days (the earlier version from Add optional typing heatmap with adaptive key zones #671, same logic).

Closes #676

…touches

One switch in Text correction, off by default. When on, the keyboard
learns where the user touches each letter key, from the words finally
committed (autocorrected word, picked suggestion, reverted correction,
or a letter retyped after deleting a neighboring one). Once a key has 30
touches, a touch near the border to a neighboring key is assigned to the
key the user most likely meant, and the dictionary gets the corrected
coordinates too. The shift is capped to a third of a key.

With the switch off, nothing is recorded and key detection runs the
unchanged code path. Never active in password fields or incognito mode.

All logic is in the heatmap package (TypingAdaptation, TypingHeatmap,
KeyboardGeometry); InputLogic, KeyDetector and PointerTracker only call
single hooks. Data is stored locally in no-backup storage and can be
included in the keyboard's own backup. A statistics screen shows the
heatmap, the most frequent misses and the weekly miss rate.

Discussed in LeanBitLab#676.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VuiaMhLXwhErf9shhrr1uD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reconsider adaptive touch correction? Slimmer proposal with details

1 participant