Further improvements to Charging station filter

This commit is contained in:
PaulStets 2018-02-26 14:01:21 +02:00
parent b0b686b258
commit 4f273cd3df

View file

@ -51,6 +51,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
@ -460,10 +461,10 @@ public class QuickSearchPoiFilterFragment extends DialogFragment {
if (filters.contains(keyName)) {
selectedPoiAdditionals.add(keyName);
filters.remove(keyName);
filterByName = filters.toString().replaceAll("[,\\[\\]]", "");
}
}
}
filterByName = nameFromSet(filters);
}
}
if (filterByName.trim().length() > 0 && Algorithms.isEmpty(nameFilterText)) {
@ -472,6 +473,21 @@ public class QuickSearchPoiFilterFragment extends DialogFragment {
}
}
private String nameFromSet(Set<String> filters) {
Iterator<String> i = filters.iterator();
if (!i.hasNext()) {
return "";
}
StringBuilder sb = new StringBuilder();
for (; ; ) {
String s = i.next();
sb.append(s);
if (!i.hasNext())
return sb.toString();
sb.append(" ");
}
}
@NonNull
private Set<String> getExcludedPoiAdditionalCategories() {
Set<String> excludedPoiAdditionalCategories = new LinkedHashSet<>();