Skip to content

feat(android): Add Grabbable Bar and settings status for keyboard resizing#15267

Merged
darcywong00 merged 16 commits intokeymanapp:masterfrom
MattGyverLee:feat/grabbable-bar-and-feedback
Dec 9, 2025
Merged

feat(android): Add Grabbable Bar and settings status for keyboard resizing#15267
darcywong00 merged 16 commits intokeymanapp:masterfrom
MattGyverLee:feat/grabbable-bar-and-feedback

Conversation

@MattGyverLee
Copy link
Copy Markdown
Contributor

@MattGyverLee MattGyverLee commented Dec 2, 2025

As dicussed on slack, I've ported the "grabbable" bar for keyboard resizing from the App builders. The bar is animated when you touch it. I've tested this in a build of the Keyman App. Resizing seems to work well after build, even though the app keeps giving (hopefully) unrelated errors about a null language. Oh, I set the % text on the resize screen to grey after I took the screenshots and merged the text boxes at the top.

WhatsApp Image 2025-12-02 at 16 18 53_ebd7ab1a

WhatsApp Image 2025-12-02 at 16 22 26_e4b46d37

WhatsApp Image 2025-12-02 at 16 22 26_282da20b

User Testing

Setup - Install the PR build of Keyman for Android on a device/emulator

  • TEST_MENU - Verifies functionality of the "Adjust Keyboard Height" menu
  1. With the device in portrait orientation, launch Keman for Android and dismiss the "Get Started" menu
  2. Observe the height of the OSK
  3. From Keyman Settings --> Adjust keyboard height
  4. Verify "Adjust keyboard height" menu
    a. Drag the bar to adjust the height, rotate the phone and adjust again
    b. Try the reset menu, then adjust to a non 100% height.
    b. Verify the corresponding portrait/landscape % updates
  5. Exit the dialog and verify that the same percentages are shown in Settings.
    Note: The settings should "stick" if you tap the back button on the top bar, the phone back button, or switch apps.
  6. Exit the settings and verify the in-app OSK matches the last keyboard heights (vertical and landscape)
    Note: The top of the keyboard image in the dialog should line up with the top of the keyboard. Both the draggable bar and the suggestion bar will show above that line.

@github-project-automation github-project-automation bot moved this to Todo in Keyman Dec 2, 2025
@keymanapp-test-bot keymanapp-test-bot bot added the user-test-missing User tests have not yet been defined for the PR label Dec 2, 2025
@keymanapp-test-bot
Copy link
Copy Markdown

keymanapp-test-bot bot commented Dec 2, 2025

User Test Results

Test specification and instructions

@keymanapp-test-bot keymanapp-test-bot bot added this to the A19S17 milestone Dec 2, 2025
@keyman-server
Copy link
Copy Markdown
Collaborator

This pull request is from an external repo and will not automatically be built. The build must still be passed before it can be merged. Ask one of the team members to make a manual build of this PR.

@MattGyverLee
Copy link
Copy Markdown
Contributor Author

I knew it was coming, but I was quite surprised when KMManager had moved on master when I went to rebase!

@MattGyverLee MattGyverLee changed the title Adding Grabbable Bar and settings status for keyboard resizing. feat(Android): Adding Grabbable Bar and settings status for keyboard resizing. Dec 2, 2025
@MattGyverLee
Copy link
Copy Markdown
Contributor Author

@mcdurdin Do we need to port this over to the FV app or KmSample2?

@darcywong00
Copy link
Copy Markdown
Contributor

@mcdurdin Do we need to port this over to the FV app or KmSample2?

I don't think so. Those apps don't have a menu to adjust the keyboard height.

@darcywong00
Copy link
Copy Markdown
Contributor

ERROR: user tests have not yet been defined

I'll update the PR description with a template for user testing. @MattGyverLee - you can adjust the test steps

@keymanapp-test-bot keymanapp-test-bot bot added has-user-test user-test-required User tests have not been completed and removed user-test-missing User tests have not yet been defined for the PR labels Dec 3, 2025
@mcdurdin mcdurdin changed the title feat(Android): Adding Grabbable Bar and settings status for keyboard resizing. feat(android): Adding Grabbable Bar and settings status for keyboard resizing. Dec 3, 2025
@mcdurdin mcdurdin changed the title feat(android): Adding Grabbable Bar and settings status for keyboard resizing. feat(android): Add Grabbable Bar and settings status for keyboard resizing Dec 3, 2025
Copy link
Copy Markdown
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution.

I'd like this to be refactored to be much simpler and not make changes to KMManager. As it stands, it's adding a large amount of API surface to Keyman Engine for very little benefit. The five KMManager functions added are all trivial utility functions, which will increase the future maintenance burden for Keyman Engine for Android.

As a basic principle, API surfaces should be kept as simple and clean as possible, and utility functions should not be added to general APIs. Part of the problem here is that years ago we were not particularly careful with a lot of the API surfaces across Keyman as a whole. But that has caused ongoing problems with maintenance of Keyman Engine for Android. So where we are now, we don't want to perpetuate the problem further.

  • In my opinion, the function calculateKeyboardHeightFromTouch is just unnecessary. It's a totally trivial calculation and is called just once; it takes 5 lines out of that single use and turns it into nearly 150 lines of very verbose documentation and code.

  • The function createKeyboardHeightString does not belong in KMManager -- this is an app presentation detail. Furthermore, the string itself needs to be localizable as a whole with parameterization. I am also uncomfortable with the 'live' variant of the function -- that parameterization should be in a higher level function that calls createKeyboardHeightString.

  • Similarly getKeyboardHeightPercentage is a trivial calculation. It could be a utility function but it should not be in Keyman Engine.

@MattGyverLee
Copy link
Copy Markdown
Contributor Author

Thanks. The refactoring should be easy, those functions got moved to KMManager on one of the last commits.

@MattGyverLee
Copy link
Copy Markdown
Contributor Author

Ok, I just cut out a LOT of spaghetti code. Ready for another look.

@keyman-server keyman-server modified the milestones: A19S17, A19S18 Dec 6, 2025
Copy link
Copy Markdown
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

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

This looks great, thank you for your contribution -- nice improvement which also retires a bit of tech debt.

@mcdurdin
Copy link
Copy Markdown
Member

mcdurdin commented Dec 8, 2025

Note: this should probably be merged as a squash merge as it is an external contribution.

MattGyverLee and others added 3 commits December 8, 2025 08:33
Co-authored-by: Marc Durdin <marc@durdin.net>
…ustKeyboardHeightActivity.java

Co-authored-by: Marc Durdin <marc@durdin.net>
…ustKeyboardHeightActivity.java

Co-authored-by: Marc Durdin <marc@durdin.net>
@MattGyverLee
Copy link
Copy Markdown
Contributor Author

Thanks! Back to you.

@mcdurdin
Copy link
Copy Markdown
Member

mcdurdin commented Dec 8, 2025

Thanks! Back to you.

you'll need to fix the call to calculateKeyboardHeightFromTouch as well

@MattGyverLee
Copy link
Copy Markdown
Contributor Author

MattGyverLee commented Dec 8, 2025

Better? I learn a lot about improving code from your reviews.

Copy link
Copy Markdown
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

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

LGTM pending build

@mcdurdin
Copy link
Copy Markdown
Member

mcdurdin commented Dec 8, 2025

I learn a lot about improving code from your reviews.

Awesome! Glad you are finding my feedback constructive 😁

Sadly, build failed:

16:52:42       /var/lib/teamcity-agent/work/30ffb35c1b6c4089/keyman/android/KMAPro/kMAPro/src/main/res/values-in-rID/strings.xml:116: Error: "drag_the_keyboard" is translated here but not found in default locale [ExtraTranslation]
16:52:42         <string name="drag_the_keyboard" comment="First line of adjusting keyboard height">Drag the keyboard to resize the height</string>
16:52:42                 ~~~~~~~~~~~~~~~~~~~~~~~~

I am out of time to do any more review; I will be unavailable until January as I am travelling back to Australia tomorrow, @darcywong00 will take over code review from here.

@MattGyverLee
Copy link
Copy Markdown
Contributor Author

MattGyverLee commented Dec 8, 2025

I had actually intended to merge those strings into one text box. Merged now with language-adaptive punctuation. @darcywong00 I hope this has also resolved the build error.

@darcywong00
Copy link
Copy Markdown
Contributor

@Meng-Heng - I'm not sure why the build artifacts weren't attached.
Here's the link to Keyman for Android

@Meng-Heng
Copy link
Copy Markdown
Contributor

I'll test this in the afternoon (my time).

@mcdurdin
Copy link
Copy Markdown
Member

mcdurdin commented Dec 9, 2025

I'm not sure why the build artifacts weren't attached.

Network glitch potentially, or status.keyman.com hiccups. We'll monitor in case this is an ongoing issue.

@Meng-Heng
Copy link
Copy Markdown
Contributor

Test Specs

  1. Android Studio, Pixel 8a API34

Test Results

  • TEST_MENU (PASSED):
  1. Launch Keyman 19.0.169-alpha-test-15267
  2. Dismiss the Startup dialog, Go to Settings
  3. Verified: Adjust keyboard height for Portrait & Landscape mode
    • The height percentage increases and decreases according to the resizing direction of the keyboard height
    • The height stays when rotating back and forth between landscape and portrait
    • Reset back to defaults work as expected.
  4. Verified: Settings screen
    • The percentages are the same
    • The settings stay after back-tapping, exiting, switching, closing the app.
  5. Verified: OSK
    • The OSK heights matches the set heights and the keyboard image in the dialog
    • Typing and using the predictive text work as expected.

@keymanapp-test-bot keymanapp-test-bot bot removed the user-test-required User tests have not been completed label Dec 9, 2025
@darcywong00 darcywong00 merged commit 444deb5 into keymanapp:master Dec 9, 2025
4 of 5 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Keyman Dec 9, 2025
@keyman-server
Copy link
Copy Markdown
Collaborator

Changes in this pull request will be available for download in Keyman version 19.0.173-alpha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants