floatingsearchview
floatingsearchview copied to clipboard
Reversed list of suggestions after recreating view.
When a search is done, the list of results appears in the right order, but after the view hierarchy is destroyed and then later recreated, the results are reversed.
Hi @Gloix,
Could you add some details to your problem?
Maybe your problem is that you are swapping the suggestions with an array and then you try to swap the suggestions again with the same array instance. If FloatingSearchView
had to reverse the suggestions list, then, your array has been reversed twice, so the suggestions list appears reversed.
If you want to maintain and reuse a suggestions list, then you should pass a copy to the FloatingSearchView.swapSuggestions
:
public class MyClass {
FloatingSearchView mSearchView;
ArrayList<SearchSuggestion> mMySuggestions;
...
private void updateSuggestions() {
mSearchView.swapSuggestions(new ArrayList<>(mMySuggestions));
}
...
}
If this is not your problem, you can check at this fix I've just created #262
I've found another problem with reversed suggestions.
There is a new PR with a fix #263
Thank you so much :D I think #263 will highly likely solve the issue. Will report back when I test a new version.