MaterialSearchBar icon indicating copy to clipboard operation
MaterialSearchBar copied to clipboard

How to make search bar always focusable to mode?

Open ajayqualwebs opened this issue 7 years ago • 5 comments

Is it possible to make search bar always focusable mode, because yet i need to click two times to then i am able to search any thing so please share with me any method by that i can achieve this function.

ajayqualwebs avatar Jan 10 '18 13:01 ajayqualwebs

add searchBar.enableSearch(); This will pre-enable the search .

ghost avatar Feb 22 '18 11:02 ghost

add searchBar.performClick() as well. It will change to search mode.

ppjuns avatar Apr 29 '18 08:04 ppjuns

I already try this method with search bar but in this condition, if I wanna go back to the previous page so I need to press back button two times.

ajayqualwebs avatar May 01 '18 04:05 ajayqualwebs

That's a bug . I am facing that problem too.

ghost avatar May 01 '18 05:05 ghost

I see the code ,author override the dispatchKeyEvent ,so you can go back the previous page by this :

override fun dispatchKeyEvent(event: KeyEvent): Boolean {
        if (event.keyCode == KeyEvent.KEYCODE_BACK && searchBar.isSearchEnabled) {
            finish()
            return true
        }
        return super.dispatchKeyEvent(event)
    }

ppjuns avatar May 02 '18 01:05 ppjuns