Skip to content

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

Merged
andrewtavis merged 3 commits into
scribe-org:mainfrom
prince-0408:refactor/general-keyboard-ime-426
Aug 12, 2026
Merged

refactor: extract FloatingKeyboardHandler from GeneralKeyboardIME (#426)#666
andrewtavis merged 3 commits into
scribe-org:mainfrom
prince-0408:refactor/general-keyboard-ime-426

Conversation

@prince-0408

@prince-0408 prince-0408 commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR is Part 1 of 6 in modularizing GeneralKeyboardIME for #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

@andrewtavis andrewtavis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

praise: Changes are looking good and all's functioning well, @prince-0408! Thanks so much!

@andrewtavis

Copy link
Copy Markdown
Member

Great to have all these refactors going 😊

@andrewtavis
andrewtavis merged commit 648a4eb into scribe-org:main Aug 12, 2026
6 checks passed
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.

2 participants