refactor: extract ShiftHandler from GeneralKeyboardIME (Part 13) - #426 - #688
refactor: extract ShiftHandler from GeneralKeyboardIME (Part 13) - #426#688prince-0408 wants to merge 1 commit into
Conversation
|
@prince-0408 Does ShiftHandler accept an injectable time source for the double-tap logic, or is it calling System.currentTimeMillis() directly? Injecting a clock would keep those timing tests deterministic. |
At present Providing the possibility of injecting I will change |
Description
This PR is Part 13 in modularizing GeneralKeyboardIME for #426.
It extracts shift key state machine management (
SHIFT_OFF➔SHIFT_ON_ONE_CHAR➔SHIFT_ON_PERMANENT), caps lock double-tap timing logic (lastShiftPressTS,shiftPermToggleSpeed), and keyboard mode switching (handleKeyboardLetters,handleModeChange) out ofGeneralKeyboardIME.ktinto a standalone helper classShiftHandler.Detailed Changes Table
ShiftHandler.ktlastShiftPressTS,shiftPermToggleSpeed), shift state cycling (handleKeyboardLetters), and layout mode switching between letter keyboard and symbol keyboard pages (handleModeChange).GeneralKeyboardIME.ktinto a dedicated helper class.GeneralKeyboardIME.ktshiftHandlerand delegated shift and mode switching methods (handleKeyboardLetters,handleModeChange). SimplifiedKEYCODE_SHIFTkey handling in event listener and updatedgetPrimarySymbolKeyboardLayoutXML()tointernalvisibility.GeneralKeyboardIME.ktwhile maintaining 100% backward compatibility for all callers.ShiftHandlerTest.ktlastShiftPressTS) and double-tap caps lock lock timing logic.CHANGELOG.md### ♻️ Code Refactoringdetailing the extraction ofShiftHandlerfromGeneralKeyboardIME.ci_changelog_checkworkflow requirement for pull requests targetingmain.Key Benefits
GeneralKeyboardIME.kt.GeneralKeyboardIME.kt.Related Issue
Refactors part of #426