Skip to content

android keyboard: emoji shortcodes (:fire β†’ πŸ”₯) in labs - #3023

Open
opencodejr[bot] wants to merge 1 commit into
devfrom
agent/issue-3009
Open

opencodejr[bot] wants to merge 1 commit into
devfrom
agent/issue-3009

Conversation

@opencodejr

@opencodejr opencodejr Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Adds Labs β€Ί Keyboard β€Ί Emoji shortcodes (off by default) to the Android keyboard, ported from iPhone Hex's lab (#2432). Requested in #3009 by @dgunay; this is a fresh implementation from the iOS source, no code taken from the fork.

Behaviour (toggle on)

  • Typing :name after a space, a line break or the start of the field shows up to 3 emoji in the strip, best in the middle. An exact name or alias comes first, then emoji whose name or keywords start with the name (:piz β†’ πŸ•). Only one emoji per family is shown.
  • Tapping one replaces the whole :name. A closing : after a full name (:fire:) does the same. No space is added.
  • The token rules are iPhone's EmojiShortcode.token: at least two ASCII letters or digits, then letters, digits, _, + and -. So abc:pizza, :p, :-D, :+1 and 10:30 stay text. Matching ignores case and reads _, + and - as spaces (:thumbs_up β†’ πŸ‘).
  • Only in fields where the keyboard reads words: not passwords, email, URL or web search fields, or TYPE_NULL editors.
  • Emoji the phone can't draw (Paint.hasGlyph) are dropped. Their line numbers are kept, so the tables still point at the right emoji.
  • Off: every hook returns early, so the keyboard is unchanged.

Changes

  • android/scripts/build-emoji-shortcodes.py builds assets/emoji/shortcodes-en.txt (168 KB) from iOS's emoji-index-en.txt. It keeps each emoji's version, family and search words, plus word and phrase postings at or above iPhone's 0.85 strong line, and checks that a few required shortcodes are present.
  • typing/EmojiShortcode.kt: the index parser and a Kotlin port of iPhone's token, matching (exact hits, prefix search scoring, one per family) and completion.
  • keyboard/EmojiShortcodes.kt: lazy background loader, modelled on EmojiWords.
  • KeyboardEngine: shows shortcode emoji after typing or deleting token characters, handles the closing :, and takes strip picks. A tap on a stale shortcode emoji is ignored rather than typed as a word, and the strip is cleared when the cursor leaves the token.
  • New Suggestion.Kind.Shortcode, placed like words (best in the middle) and described as an emoji for accessibility.
  • New emojiShortcodes preference, a Labs β€Ί Keyboard toggle, English and Chinese strings, and a README paragraph.

Differences from iPhone

  • Names are English in every layout. Android has only the English index.
  • No ranking by your own emoji use.

Testing

  • New EmojiShortcodeTest (JVM) against the bundled asset: token rules, exact-first ranking, aliases and case, one per family, the closing colon taking only full names, skipping undrawable emoji, and strip order.
  • ./gradlew :app:compileDebugKotlin :app:testDebugUnitTest: all 407 unit tests pass.
  • Spot checks on the asset: :fire β†’ πŸ”₯ πŸš’ 🧯, :piz β†’ πŸ•, :ok β†’ πŸ‘Œ πŸ‘ πŸ†—.
  • The engine wiring has no automated test (the keyboard engine needs Android's settings storage and has no unit tests), and it was not tried on a device or emulator.
  • python3 scripts/code-shape.py --check: no problems.

Closes #3009

@opencodejr opencodejr Bot added the agent-strict-review Issue pipeline: flagged patch approved by the strict reviewer label Nov 28, 2026
@opencodejr
opencodejr Bot force-pushed the agent/issue-3009 branch 2 times, most recently from 325fc68 to f0b37d5 Compare November 28, 2026 05:09

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-strict-review Issue pipeline: flagged patch approved by the strict reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android keyboard: emoji shortcodes (:fire β†’ πŸ”₯), as on iPhone

0 participants