Refactor ToolButton implementation and decouple from RimeDaemon - #2066
Merged
Conversation
- Use enum class to deserialize tool bar button shape from user config - Use AutoScaleTextView for text icon to make text auto scaled with valid padding - Use bold font style for text icon
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Refactors toolbar buttons to be “pure views” that react to option updates pushed from InputBarDelegate, and improves toolbar background typing/decoding.
Changes:
- Refactored
ToolButtonto internalize style selection and exposeoption+updateStyle(option, enabled)for toggle buttons. - Added initial syncing of toolbar toggle states from Rime options on startup, and routed subsequent option updates with
(option, enabled). - Changed toolbar background
typefromStringto an enum with safer decoding.
Reviewed changes
Copilot reviewed 5 out of 5 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/bar/ui/ToolButton.kt | Refactors content/styling logic; adds option-driven style switching; updates background building. |
| app/src/main/java/com/osfans/trime/ime/bar/ui/ButtonsBarUi.kt | Updates API to forward (option, enabled) to child ToolButtons. |
| app/src/main/java/com/osfans/trime/ime/bar/ui/AlwaysUi.kt | Updates button style propagation and adds collection of toggle options. |
| app/src/main/java/com/osfans/trime/ime/bar/InputBarDelegate.kt | Seeds toolbar toggle states from Rime and updates UI on option changes. |
| app/src/main/java/com/osfans/trime/data/theme/model/ToolBar.kt | Replaces background type string with enum + tolerant decoding. |
Suppressed comments (1)
app/src/main/java/com/osfans/trime/data/theme/model/ToolBar.kt:1
- Changing
Background.typefromStringto an enum changes the Parcelable wire format (Parcelize will now parcel an enum instead of a string). If any saved instance state / persisted parcels contain the previousStringfield layout, restoring after an app update can crash. If this model can be parceled across process recreation, consider keeping a stable serialized representation (e.g., storetype: Stringand deriveval typeEnum, or implement a custom Parceler/TypeParceler) to preserve forward-compatibility.
/*
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Bambooin
approved these changes
Aug 7, 2026
Bambooin
left a comment
Collaborator
There was a problem hiding this comment.
Verified with LineageOS 23.
Collaborator
Author
Great! My work isn't in vain at all. |
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 #2062
Feature
Describe features of this pull request
Provides a better solution than #2064 and #2065 .
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