Closed TheRishka closed 8 years ago
Hi @TheRishka ,
It would be useful if you can provide a step-by-step instructions for reproducing the problem
What kind of info do you need? Here is my xml:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="@+id/map_fragment"
android:name="MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"/>
<com.arlib.floatingsearchview.FloatingSearchView
android:id="@+id/points_map_search_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:floatingSearch_searchBarMarginLeft="@dimen/margin_medium"
app:floatingSearch_searchBarMarginTop="@dimen/margin_medium"
app:floatingSearch_searchBarMarginRight="@dimen/margin_medium"
app:floatingSearch_searchHint="@string/search_view_hint_text"
app:floatingSearch_showSearchKey="false"
app:floatingSearch_leftActionMode="noLeftAction"
app:floatingSearch_menu="@menu/menu_search"/>
</FrameLayout>
Some java code relative to SearchView:
if(mSearchView != null) {
mSearchView.setOnQueryChangeListener(searchInputListener);
mSearchView.setOnHomeActionClickListener(() -> {
mSearchView.clearSearchFocus();
});
}
As it comes from code, tapping on homeAction should remove focus from SearchView and collapse it. But...it crashes as well as it does if you tap outside of it. It appears to be a bug of animation. MinSDK - 21, Target - 23
Ok, I got it now. It crashes if there are empty menu file. What should I do to prevent crashing but leave no items in menu? I don't need any additional menu items, just blank search bar.
If you are not using the latest version (2.0.1), please update and see if you still get the crash.
There must be something else in your code that I am missing, I will investigate this bug in the next couple of days. Any additional details will be appreciated as I am unable to reproduce the issue.
In any case, OnHomeActionClickListener
is only called when the searchBar is not focused, so your call mSearchView.clearSearchFocus();
will only get called when the search is already not focused. When search is focused, a click to back arrow will be handled by the searchView itself.
I have the same issue. It happens if I dont supply a icon resource to the menu item, fx. if I only want to display text. If I supply a drawable as icon the error doesn't happen.
I also have this problem http://crashes.to/s/820fbc8afe8 I've been checking anf the return of the method getAdapterPosition() is not being tested and it can return -1 RecyclerView#NO_POSITION if item has been removed from the adapter and seems to be the case. Could you simply add that condition? Thanks.
Actually the bug that I was experiencing is the same (ArrayIndexOutOfBoundsException) but has another stacktrace which means that is another problem. I've just created a PR to fix the problem that I've been experiencing. https://github.com/arimorty/floatingsearchview/pull/85
Thanks.
@acarlsen thanks, I am trying to resolve this bug and that's what the problem is.
Hi! I've implemented your library in my proj and when I click somewhere outside of search box, it crashes with
ArrayIndexOutOfBoundsException
in MenuView. Here is the stacktrace: