Skip to content
Snippets Groups Projects
Commit a87c06b1 authored by Romain Vimont's avatar Romain Vimont Committed by Geoffrey Métais
Browse files

Clear list filter on small search query string


When a query having less than 3 chars was requested, it did nothing.

As a consequence, searching "xy" did not always give the same filtering:

   query   filter applied
   -----   ----------------
      ""   none (full list)
    "xy"   none (full list)
   "xyz"   "xyz"
    "xy"   "xyz"            <= unexpected

For consistency, always display the full list when the search query is
small.

This paves the way to keep the filter after an activity is destroyed
then re-created (e.g. on screen rotation).

Signed-off-by: default avatarGeoffrey Métais <geoffrey.metais@gmail.com>
(cherry picked from commit 947cbaae)
parent b28b1c62
No related branches found
No related tags found
No related merge requests found
......@@ -84,11 +84,13 @@ public class ContentActivity extends AudioPlayerContainerActivity implements Sea
@Override
public boolean onQueryTextChange(String filterQueryString) {
if (filterQueryString.length() < 3)
return false;
Fragment current = getCurrentFragment();
final Fragment current = getCurrentFragment();
if (current instanceof Filterable) {
((Filterable) current).getFilter().filter(filterQueryString);
final Filterable filterable = (Filterable) current;
if (filterQueryString.length() < 3)
filterable.restoreList();
else
filterable.getFilter().filter(filterQueryString);
return true;
}
return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment