mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-28 13:02:21 +01:00
* Android keyboard: spaces, punctuation and shift as on Gboard, with the typing model's strip, fixes and personal dictionary wired in
Spaces and punctuation (black box of Gboard on a Pixel 8 emulator, API 36, matched):
- Two spaces after a word within 0.95 s become ". " (Gboard: 0.87 s did, 1.07 s didn't); a third
is a plain space.
- A picked suggestion types its own space; a space right after it is swallowed but still counts
towards double-space ("Help" picked, space, space gives "Help. "); a clause-ending mark takes the
picked word's space ("Help,"). A space you typed yourself stays ("Hello ,"), as on Gboard.
- Smart space (iPhone Hex #2214, not Gboard): a word picked where the text after the cursor already
starts with a space or closing mark types no space; the next key that starts a word puts it in,
a mark goes against the word, delete takes it back. "the |_fox" + "bl" + pick + "cat" reads "the
black cat fox", where Gboard steps over the space and joins "catfox".
Shift (ShiftState, after iPhone Hex's ShiftStateMachine): acts on touch-down, so a held shift and a
letter type a capital and shift goes off as it lifts; two taps within 300 ms lock (Gboard: 0.22 s
locked, 0.37 s didn't); a long press is one shift, as on Gboard. A change of shift relabels the keys
in place instead of rebuilding the rows, so the held shift key stays mounted. Auto-capitalisation
still follows the field's caps mode.
The typing helper's work (#2245, #2251), wired in KeyboardEngine:
- While a word is typed the strip shows TypingWord.strip(): completions at once (strip(false)),
then after a 100 ms pause strip(autocorrect) with what was typed and the fix; a fix you turned down
twice shows as a plain word. Without a typed slot the likeliest word takes the middle.
- Between words: predictions(textBeforeCursor, capitalize = what shift would show).
- Personal dictionary: PersonalWords.read for each loaded language on a background thread, again
from a ContentObserver on UserDictionary.Words; <queries> for the provider in the manifest.
- On space, a closing mark or return: textReplacement() first, autocorrect on or off, with no undo;
then finish(' ', the space tap's point, the key grid) or finish(mark). A fix that spans two words
("well see" -> "We'll see") undoes as a whole; the space bar's KeyRect was already in KeyGrid.
Replaced: suggestions() + literalChip() + replacement() in the strip, the space path's
replacement(), predictions(lastWord), and shift toggling on lift with a 350 ms double tap.
Verified (emulator only, Pixel 8, probe app's text field, same 17 tapped cases on API 36 and API 31,
identical results): the spaces above, "teh" space -> "The ", "teh," -> "The,", held spaces, shift
double tap (0.15 s locks, 0.5 s doesn't); "well see" -> "We'll see", "yes id like that" -> "Yes I'd
like that", "deli" + space tapped at its top under c + "ate" -> "Delicate" (tapped mid-key: "Deli
ate"). Personal dictionary, added in Android's settings (Personal dictionary > English > Add):
"omw" -> "on my way" on space and before ".", strip "omw" | on my way; "zorbex" and the typo "zprbex"
-> "Zorbex" (API 36); "omw" also on API 31. testDebugUnitTest 41 pass (ShiftState and SpaceRules
cases added to InsertionTest), lintDebug no errors. Chords can't be injected with adb (one pointer).
* Android keyboard: mid-sentence dictation case, next-letter touch areas, and elided words start a word
Three wiring items from the dictation and typing helpers (#2239, #2260), in the same batch:
- Mid-sentence dictation: commitSpeech reads 64 characters before the cursor and runs
SpokenText.continuing(text, before, language) before insertion(); the language is the one the
dictation started with, "en" when it was translated. When the keyboard's typing model for that
language is loaded it supplies isWord (a word it has in lowercase that the books capitalise under
half the time loses Whisper's capital; a name keeps it), as iOS asks UITextChecker: the speech side's
short list doesn't have "see", so "..., See you on Monday" kept its capital without it.
- Hit test: a letter's touch passes its neighbours within TypingWord.REACH (5 dp of their touch
areas) to likelierKey(); the word list may then give the touch to a clearly likelier neighbour.
Only with autocorrect on in an ordinary text field on the letters page, never with caps lock; a
touch on a key's centre has no neighbour that close, so it always types its own key.
- Elisions: where a letter starts a word, startsWord(textBeforeCursor) replaces boundary(), so after
French "l'" or Italian "dell'" the word is read (it takes effect once those layouts exist).
Verified (emulator only, Pixel 8, API 36 unless said; probe app field):
- dictation through the emulator microphone (gRPC WAV): after "I think we should " -> "go to the park
tomorrow."; after "Thanks for the help, " -> "see you on Monday."; after "That works. " -> "Let's meet
at noon."; after "Yes and " -> "Sarah is at the station.";
- "th", then d tapped 4 px (1.5 dp) below the e/d border -> "The"; 10 px (3.8 dp) -> "The"; 17 px
(6.5 dp) -> "Thd"; d's centre -> "Thd"; in a password field and a no-suggestions field the border tap
-> "thd" (also on API 31);
- the 17 spaces/shift cases from the batch still give the same results; testDebugUnitTest 54 pass,
lintDebug no errors. Elisions not seen live: no French or Italian layout yet.
32 lines
2 KiB
XML
32 lines
2 KiB
XML
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
xmlns:tools="http://schemas.android.com/tools">
|
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
|
<uses-permission android:name="android.permission.INTERNET" />
|
|
<!-- Hex registers no non-exported dynamic receivers through ContextCompat. -->
|
|
<permission android:name="${applicationId}.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION" tools:node="remove" />
|
|
<uses-permission android:name="${applicationId}.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION" tools:node="remove" />
|
|
<uses-feature android:name="android.hardware.microphone" android:required="false" />
|
|
<!-- The keyboard reads Android's personal dictionary (UserDictionary.Words), which only the enabled
|
|
input method may read; declared so package visibility never hides the provider. -->
|
|
<queries>
|
|
<provider android:authorities="user_dictionary" />
|
|
</queries>
|
|
<application android:label="@string/app_name" android:icon="@mipmap/ic_launcher"
|
|
android:theme="@style/HexApp" android:allowBackup="false" android:usesCleartextTraffic="false" android:supportsRtl="true">
|
|
<activity android:name=".MainActivity" android:exported="true"
|
|
android:windowSoftInputMode="adjustResize">
|
|
<intent-filter>
|
|
<action android:name="android.intent.action.MAIN" />
|
|
<category android:name="android.intent.category.LAUNCHER" />
|
|
</intent-filter>
|
|
</activity>
|
|
<service android:name=".keyboard.HexKeyboard" android:label="@string/app_name"
|
|
android:theme="@style/HexIme" android:exported="true"
|
|
android:permission="android.permission.BIND_INPUT_METHOD">
|
|
<intent-filter>
|
|
<action android:name="android.view.InputMethod" />
|
|
</intent-filter>
|
|
<meta-data android:name="android.view.im" android:resource="@xml/input_method" />
|
|
</service>
|
|
</application>
|
|
</manifest>
|