Replace Set with List in Charging station filter
This commit is contained in:
parent
4f273cd3df
commit
1b9cc4ac98
1 changed files with 10 additions and 21 deletions
|
@ -50,8 +50,6 @@ import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -454,17 +452,23 @@ public class QuickSearchPoiFilterFragment extends DialogFragment {
|
||||||
extractPoiAdditionals(otherAdditionalCategories, additionalsMap, excludedPoiAdditionalCategories, true);
|
extractPoiAdditionals(otherAdditionalCategories, additionalsMap, excludedPoiAdditionalCategories, true);
|
||||||
|
|
||||||
if (additionalsMap.size() > 0) {
|
if (additionalsMap.size() > 0) {
|
||||||
Set<String> filters = new HashSet<>(Arrays.asList(filterByName.split(" ")));
|
List<String> filters = new ArrayList<>(Arrays.asList(filterByName.split(" ")));
|
||||||
for (Entry<String, List<PoiType>> entry : additionalsMap.entrySet()) {
|
for (Entry<String, List<PoiType>> entry : additionalsMap.entrySet()) {
|
||||||
for (PoiType poiType : entry.getValue()) {
|
for (PoiType poiType : entry.getValue()) {
|
||||||
String keyName = poiType.getKeyName().replace('_', ':').toLowerCase();
|
String keyName = poiType.getKeyName().replace('_', ':').toLowerCase();
|
||||||
if (filters.contains(keyName)) {
|
index = filters.indexOf(keyName);
|
||||||
|
if (index != -1) {
|
||||||
selectedPoiAdditionals.add(keyName);
|
selectedPoiAdditionals.add(keyName);
|
||||||
filters.remove(keyName);
|
filters.remove(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
filterByName = nameFromSet(filters);
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (String s : filters) {
|
||||||
|
sb.append(s);
|
||||||
|
sb.append(" ");
|
||||||
|
}
|
||||||
|
filterByName = sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (filterByName.trim().length() > 0 && Algorithms.isEmpty(nameFilterText)) {
|
if (filterByName.trim().length() > 0 && Algorithms.isEmpty(nameFilterText)) {
|
||||||
|
@ -473,21 +477,6 @@ 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
|
@NonNull
|
||||||
private Set<String> getExcludedPoiAdditionalCategories() {
|
private Set<String> getExcludedPoiAdditionalCategories() {
|
||||||
Set<String> excludedPoiAdditionalCategories = new LinkedHashSet<>();
|
Set<String> excludedPoiAdditionalCategories = new LinkedHashSet<>();
|
||||||
|
|
Loading…
Reference in a new issue