Vertical stretch keyboard

I know that some time ago, the Keyman mobile app added a way to vertically stretch the keyboard. This is a crucial feature for our teams, since we need to have 4 rows of characters.

It seems this feature does not exist for Keyboard App Builder. Am I wrong? Can it / Will it ever be added?

It’s not clear to me where you are encountering the problem. Usually a person would use Keyman Developer to create the keyboard, then use Keyman App Builder to package the keyboard for distribution. (Alternatively one could install Keyman and then load the keyboard.)

When you talk about “4 rows of characters” do you mean 4 rows including the row with the space bar? or 4 rows above the row with the space bar? Generally we recommend the former format for phones and the latter for tablets, but either could be used on either device.

Would you be able to give some more details on what you have for a keyboard layout and what you need to accomplish? Thanks!

I made the keyboard in Keyman Developer and in the picture below you can see a size comparison. When I used the .kmn file as a basis for a Keyboard App Builder app, it comes in this standard size (on the left). When I opened it using the Keyman app, you can use this setting in the Keyman app (shown on the right) to adjust the height.

You can also see what I mean by four character rows, not including the space row. So I suppose you could call it a 5 row keyboard, including the row with space. Do you know whether there is a way to make such a height adjustment in Keyboard App Builder apps?

1 Like

Thanks for this clear description of the issue. Unfortunately, I don’t know the answer to your question, but I hope someone else will!

As far as I know, this feature does not yet exist in KAB. @chrisvire may know more about any implementation plans.

I didn’t even know this was a feature of Keyman keyboards. @Marc how would KAB detect (without parsing the file) to know to give more space for the keyboard? Is there some property of KeymanEngine that we could query?

Thanks,
Chris

The Keyman Engine has this API

https://help.keyman.com/developer/engine/android/17.0/KMManager/applyKeyboardHeight

to set the keyboard height (dp). It would be the same value for all devices though.

An example from the Keyman menu for adjusting the keyboard height:

1 Like

I’m still waiting impatiently for this stretch/resize feature to be implemented via KAB. As soon as it is, I’ll happily abandon my custom-coded app and submit a KAB app instead.

Note: Even with Darcy’s help, I was never able to get this working properly in my App using KMEA.

1 Like

@chrisvire , this feature gives the user the ability to vertically stretch or shrink the KB by some percentage to make it more usable. I think it’s just a percentage of the default height.

@Matthew_Lee @Christopher_Fiorello,

If one of you could send me a KAB project (zipped up), then I could try to figure out how to support this in KAB. Please email a link to a download to chris_hubbard@sil.org

Thanks,
Chris

I have sent it, @chrisvire.

I’ve been asking for this for a long time and still need this urgently. Things look ridiculous on a portrait screen with the KB pushed down and all the wasted space for the suggestion bar I’m not using.

If you’re running into any issues using the provided API above (KMManager.applyKeyboardHeight) to accomplish your goals, please feel free to consult @darcy or me for support on this. We certainly hope the API works somewhat simply and directly, but if that’s not the case, we should certainly look into that on our end.

Like, if you feel like it should be working right but has odd effects, a description of those along with your setup could prove pretty useful towards resolving your issue.

Like, that part concerns me, and I’m willing to investigate the issue further in order to figure out where the issues and/or limitations are.

My app is a 5-year (at least) old port of KmSample2. I believe I wasn’t able to get it working in my custom app because there was a mix of deprecated and modern window settings (i could eventually resize the keyboard but not the frame). I believe resizing works in Kmsample2 (from the Kmea repo) and the official KM app which we have access to. It should be a matter of integration. I’ve asked Chris for access to the KAB codebade to try it myself.

I expect I could get this version working eventually in my custom app (as I said in another post, i could eventually resize the keyboard but not the frame on my app, probably due to some things Android Studio had suggested to change to avoid depreciation (I reported this deprecation and it may have been fixed already), but this screenshot is a KAB app. Without seeing the KAB code, I don’t know how to inject that command into a KAB-built app. In the meantime, can I open a KAB-built project in Android studio before compiling for Android?

1 Like

Since I’ve noticed this wasn’t clearly and explicitly stated: this is not a feature of specific keyboards. This is a user-oriented setting that is applied to any and all keyboards.

Keyman keyboards scale to whatever width and height you give them. A few versions back (in Android), we found ways to add this feature to our mobile apps, allowing users to choose how large (or small) they wanted their keyboard to be. The iOS implementation is notably newer, though.

You shouldn’t need to parse any KMP file or similar to do this. It’d need UI support (at some level) to allow for customization of keyboard size. Whether this is something set in stone by the KAB-app author or passed down to users of the KAB-apps as an in-app option… that’s up to y’all to sort out.

Here are some links to where the Keyman app UI facilitates this customization:

That inconsistency is… less than might be desired; we know that the engine APIs need some love.

After doing some diving with Keyboard App Builder…

Note the following line from the log:

Directory of C:\Users\User\AppData\Local\Temp\App Builder\KAB.001\a\build\outputs\apk\release

Navigating to C:\Users\User\AppData\Local\Temp\App Builder\KAB.001\a, I can see the Android project that KAB builds behind the scenes for me. From there, I can see an AppKeyboard.java buried within the src/ subfolder based upon my app’s ID.

I see that AppKeyboard.java’s main class extends org.sil.app.android.common.keyboard.SystemKeyboard, which I assume to be a KAB class. From there, I’d have to experiment to see what can be done, but there’s a pretty good shot that it is structured quite similarly to the following files in Keyman’s repository:

Note onCreateInputView() and/or onCreate(). You should be able to override either to use the Keyman API function previously noted above - KMManager.applyKeyboardHeight - either before the super call in the former (onCreateInputView) or probably anywhere in the latter (onCreate).

Granted, that’ll only get you a fixed-height keyboard - custom sized, but not something the user can size themselves. I don’t think that there’s an easy fix on Keyman’s side to give you a keyboard-sizing UI. And you’d still have to build the project yourself, outside of KAB, after making the changes.


User-facing keyboard-sizing UI would likely need to be implemented as part of KAB, utilizing the notes and references from my previous comment.

It is probably worth noting that this is not a supported or encouraged use of KAB!

1 Like

Hi @joshua_horton,
I’m happy to see the underbelly, but I just got access to the app-builder codebase, and I’m working on an attempt to implement this as I learn to trace the existing data handoffs between KAB and Android. I’ll probably test resizing with a simple user-facing list box (e.g. 80%, 90%, 100%, 110%, 120%) and if I succeed there, I might try to get KMEA’s fancy stretching interface (kmapro/AdjustKeyboardHeightActivity.java) working.
P.S. @Marc, I know this is the better way.