Using applyKeyboardHeight in KMEA

I’m just getting around to implementing applyKeyboardHeight() from #457 and KMManager.applyKeyboardHeight() in my own app.

In a test branch of my app, I’ve added a slider from 50%-200% (I know these are excessive, but just to start with).

I also have this listener:

       Slider SizeSlider = findViewById(R.id.sizeSlider);
        SizeSlider.addOnChangeListener(new Slider.OnChangeListener() {
            @Override
            public void onValueChange(@NonNull Slider slider, float value, boolean fromUser) {
                int baseheight = KMManager.getKeyboardHeight(MainActivity.this);
                int targetVal = (int) (.01 * value * baseHeight);
                KMManager.applyKeyboardHeight(MainActivity.this,targetVal);

            }
        });

And (other than Gradle 8), I’m pretty much using a stock version of: /kmsample2/SystemKeyboard.java.

I’m more than halfway there…

When setting the value lower, I get:
image

When setting it higher, I get:
image

So, the System keyboard is getting resized but not the “frame”.
While it had the visible image getting resized, it doesn’t look like KMAPro is doing anything more than I am, it just applies the new size on the back button. How do I trigger a recalculation of the frame? Could someone implement this in KMsample2?

KMEA 16.0.141

I’d love to see someone implement this in Keyboard App Builder as well.

Does your MainActivty.onResume() have this line? I think it resizes the frame as the keyboard height changes.

KMAPro’s implementation of the keyboard height menu is at

Are both your screenshots from within your keyboard app?
I was wondering if the adjusted keyboard looks fine interacting as a system keyboard on other apps (e.g. Chrome)

Both screenshots are from within the app, but since it’s based on KMSample2, it only uses “SystemKeyboard”.
The effect is the same in other apps.

I found the KMAPro Settings page, but after resizing the placeholder image, it just calls applyKeyboardHeight which I’m doing. ResizeTextView may be the key.

I was looking for something like this in onResume or an “onRefresh” but I’ll look to see if that works.

I’m happy working through interface things, but it gets a bit scary when I’m dealing with the parts that run the Keyboard. This is why I was hoping for a reference. I guess KMAPro is the one.

Is TextView the frame that the System keyboard lives in? Or is that specific to in-app keyboards? I didn’t have any of that resizeTextView() from KMAPro implemented (It’s not in KMSample2). I’ll work through that next.

I’m assuming so, but is KMAPro the Keyman App we see on the Play store? The “Pro” is was making me think it was something enterprise-level.

Yes, KMAPro is the “Keyman for Android” app on the Play store. The nomenclature is from the Tavultesoft days, separate from a free version of the app.

I think the TextView frame is the yellow field in the Keyman app that gets resized as the in-app keyboard height is adjusted.
Does your keyboard seem fine as a system keyboard?

Textview sounded like a textbox, but I was willing to try. I’m just doing a scale slider, so the textview isn’t important. That makes sense. I tried triggering OnResume after applying the Keyboard height. It wasn’t enough.

This is only a SystemKeyboard. Here’s a screenshot from the Google Search Bar after adjusting:

image

Maybe my height measurements are broken because I was trying to work around the deprecation:

I’ll set it back to the deprecated calculation and try again.

This topic was automatically closed after 13 days. New replies are no longer allowed.