Skip to content

Refactor ToolButton implementation and decouple from RimeDaemon - #2066

Merged
WhiredPlanck merged 2 commits into
osfans:developfrom
WhiredPlanck:tool-button
Aug 7, 2026
Merged

Refactor ToolButton implementation and decouple from RimeDaemon#2066
WhiredPlanck merged 2 commits into
osfans:developfrom
WhiredPlanck:tool-button

Conversation

@WhiredPlanck

Copy link
Copy Markdown
Collaborator

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

Build pass

  • make debug

Manually test

  • Done

Code Review

  1. No wildcards import
  2. Manual build and test pass
  3. GitHub Action CI pass
  4. At least one contributor review and approve
  5. Merged clean without conflicts
  6. PR will be merged by rebase upstream base

Daily build

Login and download artifact at https://github.com/osfans/trime/actions

Additional Info

- 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
@WhiredPlanck
WhiredPlanck requested a lite review from Copilot August 6, 2026 18:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ToolButton to internalize style selection and expose option + 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 type from String to 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.type from String to 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 previous String field 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., store type: String and derive val 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.

Comment thread app/src/main/java/com/osfans/trime/ime/bar/ui/ToolButton.kt
Comment thread app/src/main/java/com/osfans/trime/data/theme/model/ToolBar.kt
Comment thread app/src/main/java/com/osfans/trime/ime/bar/InputBarDelegate.kt
@WhiredPlanck
WhiredPlanck requested a review from Bambooin August 6, 2026 18:43

@Bambooin Bambooin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified with LineageOS 23.

@WhiredPlanck

Copy link
Copy Markdown
Collaborator Author

Verified with LineageOS 23.

Great! My work isn't in vain at all.

@WhiredPlanck
WhiredPlanck merged commit ad48dae into osfans:develop Aug 7, 2026
4 checks passed
@WhiredPlanck
WhiredPlanck deleted the tool-button branch August 7, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Toolbar「中」字垂直位置偏下

3 participants