Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reversed list of suggestions after recreating view. #252

Open
Gloix opened this issue Jun 15, 2017 · 3 comments
Open

Reversed list of suggestions after recreating view. #252

Gloix opened this issue Jun 15, 2017 · 3 comments

Comments

@Gloix
Copy link
Contributor

Gloix commented Jun 15, 2017

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.

@eduardbosch
Copy link

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

@eduardbosch
Copy link

I've found another problem with reversed suggestions.

There is a new PR with a fix #263

@Gloix
Copy link
Contributor Author

Gloix commented Jul 20, 2017

Thank you so much :D
I think #263 will highly likely solve the issue. Will report back when I test a new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants