Repository navigation
Keyboard: suggestion bar capsules (light capsule, blue undo), as on iOS 2.1 (#434) - #457
Conversation
…ch (refs #434) The word Space writes sits in a neutral capsule instead of bold, the undo chip is a blue capsule of the same height, dividers are 1 x 24 dp and hidden beside a capsule. Read from debug_suggestion_capsules in debuggable builds only, off by default; off, the classic bar is drawn as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Sans risque : interrupteur debug éteint par défaut
Closes #434
What this was for
iOS 2.1 draws the suggestion bar as Apple's: the word Space is about to write sits in a light capsule instead of being bold, and the undo chip after a correction is a blue capsule of the same height (iOS #502, PR #1092, on by default since #1122). Android still drew the bold word and an 8 dp rounded-rectangle chip. This PR ports the iOS look, behind a debug switch that is off by default. Switch off, the bar is develop's: the classic code path draws exactly what it drew before (only its tap lambda was hoisted so both looks share it).
To test by hand
Debug build only. On:
python3 -I tools/keyboard-bench/dictus_prefs.py --serial <serial> set --bool debug_suggestion_capsules true(it stops the app; show the keyboard again). Off: same withfalse.bonjout→bonjourin a white capsule in the centre slot, no divider beside it, words in a grey ink, no bold. Does the capsule read as a pill and not as a key?↶ bonjoutin a pale blue capsule as tall as the white one; the bar does not jump. Tap it:bonjoutcomes back.set theme dark): grey capsule, white word; dark blue undo capsule.Bonjour, the classic 8 dp chip, as on develop.Proofs
Branch
proofs/457: boards434-light.pngand434-dark.png(columns: iOS develop with capsules | Android switch on | Android switch off; rows: word about to be corrected, then undo offered), and each capture alone (android-on-*,android-off-*,ios-on-*).dictus_api35(Pixel 4 profile, 1080 × 2280), x86_64 debug build of this branch, Dictus feedback form's message field, French keyboard,bonjoutthen Space.study/evidence-1092,docs/agents/evidence/1092/dictus-on-*-b.pngand-c.png, iPhone 17 Pro simulator, same steps). Taken from that PR, not re-captured. On iOS the undo row also shows predictions (monsieur,tout); on the emulator the bar had none afterBonjour, so the two other slots are empty.Colours sampled on the emulator captures: light platter (242,242,247), capsule (255,255,255), undo (220,228,248); dark platter (10,22,40), capsule (100,108,119), undo (16,34,66).
What is ported, with its iOS source
All iOS references are
getdictus/dictus-iosdevelop at4e29e82f, fileDictusKeyboard/Views/SuggestionBarView.swiftunless named.capsuleKind(at:), lines 240-247capsuleKinds, the bar's bold slot (boldSlot) and slot 0 with an undo offercapsuleBar, lines 252-259;CapsuleMetrics.dividerWidth/Height, lines 227-228capsuleDividerShown,alpha(0f)keeps the placeCapsuleMetrics.capsuleHeightline 225CAPSULE_HEIGHT = 36.dp, row height unchangedcapsuleText, lines 302-307;CapsuleMetrics.fontSize/minimumScale, lines 218-221CapsuleText, 17 sp,suggestionTextScale(minScale = 15/17)capsuleSlot, lines 286-296Capsule().fill(pendingFill)), line 294CircleShape,weight(1f)capsuleUndoChip(word:), lines 312-326CapsuleUndoChiptriggerUndoPulse, lines 147-157 (shared with the classic chip)internal)DictusCore/Sources/DictusCore/Design/DictusColors.swift, line 20DictusColors.AccentcapsuleInksIntentional differences
.corrections) and the swiped word; Android's bold slot is already "the word Space writes" (Port dictus-ios#997: confidence margin, context and deterministic ties for trie corrections #388), so the capsule takes its place. Android has no swipe typing, so no swiped-word capsule.debug_suggestion_capsules, read only when the build is debuggable, no row in Réglages). iOS has it on by default since 2.1 (KeyboardFeatureSettings.swiftline 56) and always on in Release (line 245). Turning it on for everyone is a later PR.ic_undovector at 15 dp for SFarrow.uturn.backward13 pt medium (a vector has no weight).Code
ime/.../ui/SuggestionBarCapsules.kt(new):LocalSuggestionCapsules,CapsuleSuggestionBar,CapsuleUndoChip,capsuleInks.ime/.../ui/SuggestionBar.kt: drawsCapsuleSuggestionBarwhen the switch is on; the slot tap moved intoonSlotTap, shared by both;suggestionTextScaletakes aminScale(default 1, so the classic bar is unchanged); the pulse constants areinternal.core/.../PreferenceKeys.kt:DEBUG_SUGGESTION_CAPSULES.ime/.../DictusImeService.kt: reads it when debuggable and provides it to the keyboard, likedebug_ios_typing_fixes.tools/keyboard-bench/dictus_prefs.py: names the key in its doc (the tool already sets any boolean).typing.suggestion-capsules(iOS's ID) intyping.autocorrect.md, andkbd.suggestionsinscreens.md.Display only: no change to what is suggested, what Space applies, or when.
Tests
flock /tmp/dictus-gradle.lock ./gradlew :core:testDebugUnitTest :ime:testDebugUnitTest :app:testDebugUnitTest lint assembleDebug: exit 0.SuggestionBarCapsulesTest(8 tests, Robolectric): which slot gets which capsule, hidden dividers, the 15/17 shrink, dividers flush with the capsule, the undo capsule still restores the word, a tap sends the same word as the classic bar, switch off draws no capsule. The existing bar tests (SuggestionBarTest,SuggestionBarBoldSlotTest,SuggestionBarLargeFontTest,AutocorrectUndoChipUiTest…) pass unchanged.needs-physical-testis not set by the labeler (no audio path touched); the light capsule's legibility is worth Pierre's eye on the Pixel (step 1 above).🤖 Generated with Claude Code
Summary by CodeRabbit