refactor: add targeted key appearance update mechanism#1966
Merged
Bambooin merged 1 commit intoosfans:developfrom Mar 30, 2026
Merged
refactor: add targeted key appearance update mechanism#1966Bambooin merged 1 commit intoosfans:developfrom
Bambooin merged 1 commit intoosfans:developfrom
Conversation
775e4ee to
c23169c
Compare
There was a problem hiding this comment.
Pull request overview
Refactors keyboard redraw behavior by introducing a targeted “key appearance update” broadcast path, so only keys whose visuals depend on Rime state (e.g., composing/menu/paging) are invalidated instead of forcing full-keyboard redraws.
Changes:
- Introduces
onKeyAppearanceUpdate(composing, menu)broadcast plumbing and emits it fromInputViewwhen tracked appearance state changes. - Tracks and invalidates only state-dependent keys via
Keyboard.appearanceStateKeysand per-key indices. - Adds
KeyboardView.invalidateKeyByIndex()to support targeted redraws.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/main/java/com/osfans/trime/ime/keyboard/KeyboardWindow.kt | Switches from composition-based full invalidation to targeted invalidation on key appearance updates. |
| app/src/main/java/com/osfans/trime/ime/keyboard/KeyboardView.kt | Adds per-index key invalidation helper. |
| app/src/main/java/com/osfans/trime/ime/keyboard/Keyboard.kt | Renames key list for stateful appearance and assigns stable key indices. |
| app/src/main/java/com/osfans/trime/ime/keyboard/Key.kt | Adds index field and marks keys with state-dependent behaviors for targeted updates. |
| app/src/main/java/com/osfans/trime/ime/core/InputView.kt | Tracks appearance-related state and broadcasts key appearance updates on change. |
| app/src/main/java/com/osfans/trime/ime/broadcast/InputBroadcaster.kt | Forwards the new key appearance update callback to receivers. |
| app/src/main/java/com/osfans/trime/ime/broadcast/InputBroadcastReceiver.kt | Adds the new onKeyAppearanceUpdate callback to the receiver interface. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
app/src/main/java/com/osfans/trime/ime/keyboard/KeyboardView.kt
Outdated
Show resolved
Hide resolved
c23169c to
d6f3a1a
Compare
Bambooin
approved these changes
Mar 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request
Issue tracker
Fixes will automatically close the related issues
Fixes #
Fixes #
Feature
Describe features of this pull request
Code of conduct
Code style
make sytle-lintBuild pass
make debugManually test
Code Review
Daily build
Login and download artifact at https://github.com/osfans/trime/actions
Additional Info