From a34a396aa7d42cb4929b1895d76b1d989081d442 Mon Sep 17 00:00:00 2001 From: PaulStets Date: Mon, 26 Feb 2018 12:47:40 +0200 Subject: [PATCH] Fixed the issue with incorrect values being selected in Charging station filter --- .../osmand/plus/search/QuickSearchPoiFilterFragment.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchPoiFilterFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchPoiFilterFragment.java index 40b577cd9d..f4da4f76de 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchPoiFilterFragment.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchPoiFilterFragment.java @@ -45,10 +45,12 @@ import net.osmand.util.Algorithms; import java.text.MessageFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; @@ -451,11 +453,11 @@ public class QuickSearchPoiFilterFragment extends DialogFragment { extractPoiAdditionals(otherAdditionalCategories, additionalsMap, excludedPoiAdditionalCategories, true); if (additionalsMap.size() > 0) { + Set filters = new HashSet<>(Arrays.asList(filterByName.split(" "))); for (Entry> entry : additionalsMap.entrySet()) { for (PoiType poiType : entry.getValue()) { String keyName = poiType.getKeyName().replace('_', ':').toLowerCase(); - index = filterByName.indexOf(keyName); - if (index != -1) { + if (filters.contains(keyName)) { selectedPoiAdditionals.add(keyName); filterByName = filterByName.replaceAll(keyName, ""); }