Skip to content

Fix #161: Apply landscape keyboard height dynamically on orientation … - #164

Open
FarzanArzoiy wants to merge 1 commit into
tribixbite:mainfrom
FarzanArzoiy:main
Open

Fix #161: Apply landscape keyboard height dynamically on orientation …#164
FarzanArzoiy wants to merge 1 commit into
tribixbite:mainfrom
FarzanArzoiy:main

Conversation

@FarzanArzoiy

Copy link
Copy Markdown

Description

This PR fixes Issue #161: the landscape height slider did nothing, while the portrait slider controlled both orientations.

Root cause: the keyboard height was calculated once on initial layout and never updated when:

  • The user moved the landscape height slider.
  • The device rotated between portrait and landscape.

Solution:

  • Added refreshKeyboardHeight() method that recalculates the height using NeuralLayoutBridge (which already knows how to pick the correct preference based on orientation and foldable state) and applies it to the keyboard view.
  • Called this method in onConfigurationChanged() so the height updates immediately when the device rotates.
  • Called it in onSharedPreferenceChanged() when any height‑related preference (keyboard_height, keyboard_height_landscape, etc.) changes, so the landscape slider takes effect instantly.

Impact: users can now set independent heights for portrait and landscape, and both sliders work correctly. No other behaviour is altered.


Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • 🎨 Style/UI change (formatting, visual improvements)
  • ♻️ Code refactoring (no functional changes)
  • ⚡ Performance improvement
  • ✅ Test update/addition
  • 🔧 Build/configuration change

Related Issues

Closes #161
Related to #161


Changes Made

  • Added refreshKeyboardHeight() method in CleverKeysService.kt.
  • Called it in onConfigurationChanged() after refresh_config().
  • Added a check for height‑related preference keys in onSharedPreferenceChanged() and called refreshKeyboardHeight().

Testing Performed

Manual Testing

Test Device:

  • Device: Samsung Galaxy A31
  • Android Version: 12
  • CleverKeys Version: latest dev

Test Scenarios:

  • Set portrait height = 40%, landscape = 60%, open keyboard in portrait → height is 40%.
  • Rotate to landscape → height becomes 60%.
  • Adjust landscape slider → height updates immediately.
  • Rotate back to portrait → height returns to 40%.
  • Ensure no other settings are affected (e.g., margins, opacity, layout).

Results:
All tests pass. The landscape slider now works exactly as expected, and orientation switching updates the height correctly.

Automated Testing

./gradlew test
./gradlew lint

…ientation change and preference update

- Add refreshKeyboardHeight() that recalculates height from NeuralLayoutBridge
- Call it in onConfigurationChanged() when device rotates
- Call it in onSharedPreferenceChanged() when height-related prefs change
- This makes the landscape slider work immediately and keeps portrait/landscape heights independent
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

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.

[bug]: changing the portrait mode height changes the height for both landscape and portrait modes

1 participant