Skip to content

Refactor: Extract UI Management from GeneralKeyboardIME to KeyboardUIManager #540

@bhanu-dev82

Description

@bhanu-dev82

Terms

Description

The GeneralKeyboardIME class currently violates the Single Responsibility Principle by handling both the InputMethodService lifecycle and the detailed manipulation of the UI view bindings.

Currently, methods like updateUI(), setupIdleView(), setupToolbarView(), updateButtonVisibility(), and updateCommandBarHintAndPrompt() clutter the main service class.

Proposal

Create a new class KeyboardUIManager (or KeyboardLayoutHelper) that:

  1. Takes the InputMethodViewBinding in its constructor.
  2. Manages the state transitions (IDLE, SELECT_COMMAND, etc.) and updates the views accordingly.
  3. Exposes simple methods like showIdleState() or showCommandState() that GeneralKeyboardIME can call.

Benefits

  • drastically reduces the line count of GeneralKeyboardIME.
  • Decouples UI logic from Service lifecycle.
  • Makes it easier to change the UI layout in the future without breaking the service logic.

Contribution

I am happy to work on this refactor.

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is neededrefactorRefactor code to improve quality

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions