Skip to content

refactor: deduplicate isTablet method across language subclasses (#426) - #667

Open
prince-0408 wants to merge 2 commits into
scribe-org:mainfrom
prince-0408:refactor/deduplicate-istablet-426
Open

refactor: deduplicate isTablet method across language subclasses (#426)#667
prince-0408 wants to merge 2 commits into
scribe-org:mainfrom
prince-0408:refactor/deduplicate-istablet-426

Conversation

@prince-0408

Copy link
Copy Markdown
Collaborator

Description

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

It removes duplicate isTablet() implementations and SMALLEST_SCREEN_WIDTH_TABLET = 600 constants across all 8 language keyboard subclasses and standardizes tablet detection in KeyboardUIManager.kt.

Summary of Changes Table:

File / Component Refactoring Applied Impact
GeneralKeyboardIME.kt Added protected open fun isTablet() & SMALLEST_SCREEN_WIDTH_TABLET = 600 Centralized base implementation
KeyboardUIManager.kt Standardized isTablet to use GeneralKeyboardIME.SMALLEST_SCREEN_WIDTH_TABLET Consistent 600dp threshold
EnglishKeyboardIME.kt Removed duplicate isTablet() & SMALLEST_SCREEN_WIDTH_TABLET Inherited from base (-6 lines)
FrenchKeyboardIME.kt Removed duplicate isTablet() & SMALLEST_SCREEN_WIDTH_TABLET Inherited from base (-6 lines)
GermanKeyboardIME.kt Removed duplicate isTablet() & SMALLEST_SCREEN_WIDTH_TABLET Inherited from base (-6 lines)
ItalianKeyboardIME.kt Removed duplicate isTablet() & SMALLEST_SCREEN_WIDTH_TABLET Inherited from base (-6 lines)
PortugueseKeyboardIME.kt Removed duplicate isTablet() & SMALLEST_SCREEN_WIDTH_TABLET Inherited from base (-6 lines)
RussianKeyboardIME.kt Removed duplicate isTablet() & SMALLEST_SCREEN_WIDTH_TABLET Inherited from base (-6 lines)
SpanishKeyboardIME.kt Removed duplicate isTablet() & SMALLEST_SCREEN_WIDTH_TABLET Inherited from base (-6 lines)
SwedishKeyboardIME.kt Removed duplicate isTablet() & SMALLEST_SCREEN_WIDTH_TABLET Inherited from base (-6 lines)

Key Benefits:

  • Deduplication: Removed 48 duplicate lines of code across all 8 language keyboard subclasses.
  • Consistency: Standardized tablet detection across keyboard services and UI manager to use the unified 600dp threshold.
  • Zero Functional Changes: All subclasses inherit the exact same tablet detection logic.

Related Issue

Refactors part of #426

Type of Change

  • Refactoring (no functional changes, no API changes)

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