Understanding keyboard shortcuts in Jetpack Compose
summary
A sample app called keyboard shortcut demo demonstrates cross‑platform shortcut support by mapping a platform‑agnostic KeyboardShortcut class to Android’s onProvideKeyboardShortcuts / onKeyShortcut, iOS UIKeyCommand, and a desktop menu bar. The class uses a conflated channel and flow to publish presses to Composables; dropdown items render key labels via a custom renderer. Access keys underline one character with a regex and intercepts use onPreviewKeyEvent; iOS needs extra filtering (Alt+D inserts characters) and Android requires a Gboard workaround for dictation. The implementation compiles and runs across Android, iPad, and desktop with noted platform quirks.
AI-written summary · about
chapters (8)
- 0:00Keyboard shortcuts in Jetpack Compose
- 5:07Defining shortcuts and access keys
- 9:00Global shortcuts in Compose
- 16:33Shortcuts with flows and UI updates
- 21:51Shortcuts on iOS and desktop
- 27:06Access keys in Jetpack Compose
- 31:05Key event handling with onPreviewKeyEvent
- 36:25Detecting physical keyboards
related talks
46mJetpack Compose: UI Toolkit for Android and Desktop
28mJetpack Compose Techniques Needed at the Product Level
01h 12mJetpack Compose over inheritance
15mInput for all screens
36mNavigation focus in 2024: Supporting keyboard navigation with Compose
41mJetpack Compose is Swift (UI).
40mDevelopers Without Borders: Jetpack Compose for Android and iOS
32mJetpack Compose — Next Gen Kotlin UI Toolkit for Android
