Skip to content

refactor: extract FloatingKeyboardHandler from GeneralKeyboardIME (#426) - #666

Open
prince-0408 wants to merge 2 commits into
scribe-org:mainfrom
prince-0408:refactor/general-keyboard-ime-426
Open

refactor: extract FloatingKeyboardHandler from GeneralKeyboardIME (#426)#666
prince-0408 wants to merge 2 commits into
scribe-org:mainfrom
prince-0408:refactor/general-keyboard-ime-426

Conversation

@prince-0408

Copy link
Copy Markdown
Collaborator

Description

This PR is Part 1 of 6 in modularizing GeneralKeyboardIME to resolve #426.

This PR extracts all floating keyboard management, scaling calculations, resize handle handlers, and touch/drag listeners out of GeneralKeyboardIME.kt into a standalone helper class: FloatingKeyboardHandler.kt.

Key Changes in this PR (Part 1/6):

  • Created FloatingKeyboardHandler: Encapsulates floating mode state (isFloatingMode), layout parameters, card theme styling, resize touch listeners, corner animations, and floating position calculations.
  • Reduced Monolithic Class Size: Delegated floating mode methods in GeneralKeyboardIME.kt to floatingKeyboardHandler, shrinking GeneralKeyboardIME.kt by 550 lines (from 2,808 down to 2,259 lines).
  • Zero Functional Changes: Pure refactoring that strictly preserves existing floating keyboard behavior, drag gestures, and preferences saving (PreferencesHelper).

Refactoring Roadmap Status (#426)

  • Part 1 (This PR): Extract FloatingKeyboardHandler (~550 lines removed).
  • Part 2 (Next): Deduplicate isTablet() across 8 language subclasses into GeneralKeyboardIME.
  • Part 3: Extract Clipboard Panel logic out of GeneralKeyboardIME into ClipboardHandler.
  • Part 4: Introduce ScribeLanguage Enum to replace raw string comparisons ("English", "German").
  • Part 5: Remove language-specific layout assumptions ("English", "Russian", "Swedish" -> "2x2") from base class.
  • Part 6: Replace Non-Null Assertions (!!) in keyboard services with safe calls.

Related Issue

Refactors part of #426

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.

Code improvements to make Scribe ready for future features

1 participant