Skip to content

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

Merged
andrewtavis merged 2 commits into
scribe-org:mainfrom
prince-0408:refactor/deduplicate-istablet-426
Aug 12, 2026
Merged

refactor: deduplicate isTablet method across language subclasses (#426)#667
andrewtavis merged 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)

@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 scoped and sensible, @prince-0408! Thanks for the work here! 😊

@andrewtavis
andrewtavis merged commit 288d00e into scribe-org:main Aug 12, 2026
7 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.

Code improvements to make Scribe ready for future features

2 participants