arimorty / floatingsearchview

A search view that implements a floating search bar also known as persistent search
https://github.com/arimorty/floatingsearchview/blob/master/README.md
Apache License 2.0
3.54k stars 668 forks source link

Permanent keyboard #244

Open KevCel opened 7 years ago

KevCel commented 7 years ago

When I hide app/debug app/someone call to me a keyboard is still visible.

Android 6.0, LG K8 device

spiralni commented 7 years ago

It happens to me too.. I am using a device with android 5.0

KevCel commented 7 years ago

It's my temporary solution.

`@Override protected void onPause() { super.onPause();

    View view = this.getCurrentFocus();
    if (view != null) {
        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
    }
}`
eduardbosch commented 7 years ago

I've tried to find a way to hide the keyboard from the view automatically, but I haven't found a way to ensure that Util.closeSoftKeyboard is called before the activity has paused. So calling Util.closeSoftKeyboard after the activity has paused does not hide the keyboard.

I think the best solution is @KevCel to be sure that the keyboard is hidden before pausing an activity.

Maybe a better approach could be to use the library close function to be sure we hide the keyboard the same way as the library does:


    @Override
    protected void onPause() {
        // Hide keyboard always on pause
        Util.closeSoftKeyboard(this);

        super.onPause();
    }