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

Search View Not Working #51

Closed
med1n4 opened this issue Aug 6, 2023 · 3 comments
Closed

Search View Not Working #51

med1n4 opened this issue Aug 6, 2023 · 3 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested

Comments

@med1n4
Copy link

med1n4 commented Aug 6, 2023

Hello @amirisback.

I recently cloned down your project and tried to use the search web view only to find that it wasnt working. When I am focused on the Google search bar and type an input, the text doesnt go into the correct search field. The text goes into the original field that opened the keyboard.

The same thing happens in the Form View too.

I'm wondering if this is a known issue or if there is a fix for this?

Thanks!

@rafifrabbani
Copy link

after looking at previous version from this library. I manage to found the solution

paste below code to your KeyboardIME class

override fun onKey(code: Int) {

        val formView = binding?.keyboardForm
        var inputConnection = currentInputConnection

        if (formView?.visibility == View.VISIBLE) {
            val et1 = formView.binding?.etText
            val et1Connection = et1?.onCreateInputConnection(EditorInfo())

            val et2 = formView.binding?.etText2
            val et2Connection = et2?.onCreateInputConnection(EditorInfo())

            val et3 = formView.binding?.etText3
            val et3Connection = et3?.onCreateInputConnection(EditorInfo())

            if (et1?.isFocused == true) {
                inputConnection = et1Connection
            } else if (et2?.isFocused == true) {
                inputConnection = et2Connection
            } else if (et3?.isFocused == true) {
                inputConnection = et3Connection
            }

        } else if (binding?.keyboardWebview?.visibility == View.VISIBLE) {
            inputConnection =
                binding?.keyboardWebview?.binding?.webview?.onCreateInputConnection(EditorInfo())
        } else {
            inputConnection = currentInputConnection
        }
        onKeyExt(code, inputConnection)
    }

@amirisback
Copy link
Owner

amirisback commented Sep 16, 2023

after looking at previous version from this library. I manage to found the solution

paste below code to your KeyboardIME class

override fun onKey(code: Int) {

        val formView = binding?.keyboardForm
        var inputConnection = currentInputConnection

        if (formView?.visibility == View.VISIBLE) {
            val et1 = formView.binding?.etText
            val et1Connection = et1?.onCreateInputConnection(EditorInfo())

            val et2 = formView.binding?.etText2
            val et2Connection = et2?.onCreateInputConnection(EditorInfo())

            val et3 = formView.binding?.etText3
            val et3Connection = et3?.onCreateInputConnection(EditorInfo())

            if (et1?.isFocused == true) {
                inputConnection = et1Connection
            } else if (et2?.isFocused == true) {
                inputConnection = et2Connection
            } else if (et3?.isFocused == true) {
                inputConnection = et3Connection
            }

        } else if (binding?.keyboardWebview?.visibility == View.VISIBLE) {
            inputConnection =
                binding?.keyboardWebview?.binding?.webview?.onCreateInputConnection(EditorInfo())
        } else {
            inputConnection = currentInputConnection
        }
        onKeyExt(code, inputConnection)
    }

can u contribute to this project, please fork and make pull request, I would be happy to @rafifrabbani

@amirisback amirisback added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested labels Sep 16, 2023
@amirisback
Copy link
Owner

Hello @amirisback.

I recently cloned down your project and tried to use the search web view only to find that it wasnt working. When I am focused on the Google search bar and type an input, the text doesnt go into the correct search field. The text goes into the original field that opened the keyboard.

The same thing happens in the Form View too.

I'm wondering if this is a known issue or if there is a fix for this?

Thanks!

Thank you for your report, will fix asap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested
Projects
Development

No branches or pull requests

3 participants