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

Dynamic leftActionMode #37

Closed ernestkamara closed 8 years ago

ernestkamara commented 8 years ago

Why is the setLeftActionMode in FloatingSearchView not exposed? I have a single Activity with Fragments and would be nice if i can use "Home-up/ back arrow" as the left action mode for navigation back to the previous Fragment.

arimorty commented 8 years ago

Try using: app:floatingSearch_leftActionMode="showHome" And then listen for it using mSearchView.setOnLeftMenuClickListener(...)

ernestkamara commented 8 years ago

Are u suggesting have a new layout for my search fragment? I know that as an option B, but would like a single floatingsearchview for the whole app.

arimorty commented 8 years ago

I do not understand your problem. My previous solution will give you a left arrow in the search view to which you will be able to listen to and switch fragments as needed. To make the search bar show the back arrow, add: app:floatingSearch_leftActionMode="showHome" in xml

ernestkamara commented 8 years ago

Thanks for your replies! I am trying to use your search view with a single Activity and multiple Fragments, meaning i have to handle the back arrow. My main screen uses app:floatingSearch_leftActionMode="showSearch" and would like to change the search view to app:floatingSearch_leftActionMode="showHome" after search is complete, so that the user can navigate back to the previous screen.

ernestkamara commented 8 years ago

In other words i would like to switch between showSearch and showHome dynamically .

arimorty commented 8 years ago

Ok then, I will look into it later and will add it to next release. I don't know when the next release is going to happen, but you can always download the library, dig into the code, make that method public, adn setup the lib as a local lib in your project.

ernestkamara commented 8 years ago

Would this be added in the next release @arimorty ?

arimorty commented 8 years ago

I will try my best for this release, if not this than next one (2.2.0) the next release contains very important fixes so I want it to be out within a few days

arimorty commented 8 years ago

Will be included in 2.0.0

nurhadi-ab commented 8 years ago

hi @arimorty ,,, when will the 2.2.0 version be released? i need this feature,, i have no idea how to go back to the previous view if user want to cancel search.

arimorty commented 8 years ago

Hi,

The mentioned release 2.2.0 is an error, this feature was actually included in 2.0.0 (look at the milestone)

You can set the leftActionMode dynamically using this and you can also listen to when the left arrow is clicked. To be clear, the left action mode is the left button that is visible when search is NOT focused. If you want to switch a view or otherwise react to when the search loses focus, you can set a listener for focus changes.

Hope it helps. Please refer to the detailed sample project if you have questions before submitting a new issue.

Thanks,