Fix condition for equality check of search queries

This commit is contained in:
Alexander Sytnyk 2018-03-28 19:15:15 +03:00
parent ad47daaadc
commit 2291ed1b7c

View file

@ -75,13 +75,15 @@ public class WikivoyageSearchDialogFragment extends BaseOsmAndDialogFragment imp
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
String newQuery = s.toString(); String newQuery = s.toString();
if (newQuery.isEmpty()) { if (!searchQuery.equalsIgnoreCase(newQuery)) {
searchHelper.cancelSearch();
switchProgressBarVisibility(false);
adapter.setItems(null);
} else if (!searchQuery.equalsIgnoreCase(newQuery)) {
searchQuery = newQuery; searchQuery = newQuery;
searchHelper.search(searchQuery); if (searchQuery.isEmpty()) {
searchHelper.cancelSearch();
switchProgressBarVisibility(false);
adapter.setItems(null);
} else {
searchHelper.search(searchQuery);
}
} }
} }
}); });