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 667 forks source link

Listen to Back Arrow button #311

Open hqdai opened 6 years ago

hqdai commented 6 years ago

hi Airmorty, If I use LeftActionMode(2) (Search icon), when I click on that or click on search input text then press Back Arrow icon, it seems no Event Listener to handle Back Arrow icon pressed.

Thanks, Daniel

spapapan commented 6 years ago

I need this functionality also. Anyone knows how to catch that event?

yolave commented 6 years ago

To achieve this, you need to get the back arrow view from the floating search. This is the way how i do it:

//Setting on click listener when user press home image View leftActionIcon = floatingSearchView.findViewById(com.arlib.floatingsearchview.R.id.left_action); leftActionIcon.setOnClickListener(v -> { //DO WHATEVER YOU WANT HERE });

I hope this help you.

Cheers