Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyboardHeight not right in some device #50

Closed
klistin opened this issue Nov 18, 2020 · 7 comments
Closed

KeyboardHeight not right in some device #50

klistin opened this issue Nov 18, 2020 · 7 comments

Comments

@klistin
Copy link

klistin commented Nov 18, 2020

I test my demo in Rog phone. Resolution is 2340 * 1038. I want to change my component according to soft Ketboard Height ,but the value is not right , try mate30 is so . samsung s7 is right , Very strange

@SuperLin10
Copy link

looks like screen height get error

// keyboardProvider.java
//....
    private void handleOnGlobalLayout() {
        Point screenSize = new Point();
        activity.getWindowManager().getDefaultDisplay().getSize(screenSize);
        int screenHeight = parentView.getHeight();
        Rect rect = new Rect();
        popupView.getWindowVisibleDisplayFrame(rect);
        int keyboardHeight = screenHeight - rect.bottom;
        boolean isShow = screenSize.y - rect.bottom > 0;
//.....

@JaneQ14
Copy link

JaneQ14 commented Jan 6, 2021

can you add a function that shows the size of the keyboard in real time?

@mopsicus
Copy link
Owner

mopsicus commented Jan 8, 2021

What you mean "in real time"? It works in real time, get difference between screen height and keyboard, and return it.

@JaneQ14
Copy link

JaneQ14 commented Jan 8, 2021

I need a function that returns me a keyboard size value at any time.
This is my question https://answers.unity.com/questions/1802582/android-keyboard-height-not-working.html
i use your plugin but it only gets size when opening the keyboard, i can't create this function.

@mopsicus
Copy link
Owner

mopsicus commented Jan 8, 2021

You can't get keyboard size while keyboard is hidden.
You can only get keyboard size when it shown, save the value and use it when you need. But it's not correct, because user can change some keyboard settings, and in next time you will get new height of keyboard. So, that is the answer – size of keyboard need process each time when it shows.

@JaneQ14
Copy link

JaneQ14 commented Jan 8, 2021

I found something like this, and for example it is used in regular input fields, when the size of the keyboard changes while it is open then the EditText dialog always stays above it as in the example:
https://programming.vip/docs/android-adjustnothing-get-keyboard-height.html

@mopsicus
Copy link
Owner

Oh, now I found out what you want..
In current realization if keyboard is opened, next event with height will not send, take a look
So, you can remove that check, and build new AAR lib.
In next update, I will fix it.

PrisedRabbit added a commit to PrisedRabbit/UnityMobileInput that referenced this issue Jan 19, 2021
keyboard height calculation now consider navigation bar
mopsicus added a commit that referenced this issue Jan 19, 2021
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

No branches or pull requests

4 participants