Closed Pabloku closed 8 years ago
For the first one, I'll take it into consideration in the next release. For the second one, after the release I was waiting for such a request, and here it comes.... So, I'll think about if it fits with my vision for the library at this stage and will added it to release 1.1.0 if it does.
Ok! Thanks very much!
+1 for point one. I was wondering how to set the search text
Hi @arimorty! Just to confirm: point one has not been implemented yet in version 1.1.0, right?
Thanks!
Hi @Pabloku,
My understanding is that you suggest that the search view remain focused when a suggestion item is selected, right? The problem is that even if the search remains focused and the suggestions are closed, there is still that shadow that will shadow your views beneath it, so what's the point? Which leads us to your point 2, but again, I am not sure that this is a good idea for now, and here is why:
The library at its current state is aiming on implementing a search like you can see in the Google Play app where when the search view is clicked, the search shadows the other content, and a suggestion click will confirm the search and return focus to the main content that will process the search.
If all you want is to show the last search in the search view after it lost focus, you can use https://github.com/arimorty/floatingsearchview/blob/master/library/src/main/java/com/arlib/floatingsearchview/FloatingSearchView.java#L958 to set the bar's text to the searched text in onSearch listener.
Use the new version 1.1.2 that also fixed minor bugs.
Thanks, Ari
Thanks!
setSearchText was what I needed, but now, it would be grate to be able to show the X button on the right side ;) Let me show you a capture of what I am trying:
I am trying to do it using the _app:floatingSearch_menu="@menu/menusearchbox" but icon is not showing. It just shows the 3 point icon menu.
Hope you understand me. Sorry about my poor english.
Thanks!
@Pabloku First, I don't see any problem in your English. Second, the three dots will show if your menu_searchbox contains more than one item and there isn't enough room to show them or they are set to app:showAsAction="never". You can refer to the README for details.
The main point is that you can achieve one of the following depending on your situation:
If you go with one of the approaches, you are left with one problem: The X that comes with the library will show when the user types in addition to the X of your menu item. So your are now stuck with two Xs ): But, wait, there is a workaround. Use mSearchView.setClearBtnColor(Color.TRANSPARENT); and you won't see the clear button that comes with the view, and then handle search clear yourself by calling setSearchText("").
Let me know the results. BTW, I loved that you made use of a menu item for showing the X. I simply didn't think about it :)
I am glad my feedback helps! Just some comment. I am not able to make app:showAsAction="always" work. I have just one item in my menu and it is always showing the three dots icon...
Hey, @Pabloku The below works for me.
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" >
<item
android:id="@+id/action_clear"
android:orderInCategory="1"
android:title="@string/action_clear"
android:icon="@drawable/ic_clear_black_24dp"
app:showAsAction="always" />
</menu>
However, if you set app:floatingSearch_searchBarWidth="" to a very small width, or if the screen width is small, there won't be room for the icon, so it will display as dots. "always" really means: show the icon always, search focused or not, if there is room; otherwise, show the menu item in the overflow menu.
Hope it helps.
All the best, Ari
Not working for me :S It is really strange. In designer, I see the icon, but not when executing the app on the device....
I is not strange at all, if you read my previous answer, the view decides if there is enough room for icons and then puts dots if there isn't any. Now, currently, this is measured by screenW - 225dp (min that is assumed to be needed for input and left icon to fit) and looking if the result will leave room for icons.
The reason you see different results in the designer is that the screen width when in designer mode is set to 360dp which when applying the above will leave room for icons. (I should changed that when I get a chance though).
I will reopen the issue to make all of these points more flexible by providing a method to set the min width that is needed for input and left icon to fit. I will include it in next release (probably week or two).
Ok thanks!
It works well in mobile phone, but in the android tv, it can't get the focus when the key up,down pressed. Hope it could be compatible in android tv.
This lib is not intended and was not tested on Android TV.
Hi again @arimorty!
Just 2 suggestions for some common uses:
Thanks very much!