diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 6b929a0cc5..e31979ba44 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -2336,7 +2336,7 @@ public class OsmandSettings { public Set getSelectedPoiFilters() { Set result = new LinkedHashSet<>(); String filtersId = SELECTED_POI_FILTER_FOR_MAP.get(); - if (filtersId != null && !filtersId.isEmpty()) { + if (filtersId != null && !filtersId.trim().isEmpty()) { Collections.addAll(result, filtersId.split(",")); } return result; diff --git a/OsmAnd/src/net/osmand/plus/poi/PoiUIFilter.java b/OsmAnd/src/net/osmand/plus/poi/PoiUIFilter.java index 8dcd5b452e..149d4efef3 100644 --- a/OsmAnd/src/net/osmand/plus/poi/PoiUIFilter.java +++ b/OsmAnd/src/net/osmand/plus/poi/PoiUIFilter.java @@ -113,6 +113,13 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable updatePoiAdditionals(); } + public PoiUIFilter(Set filtersToMerge, OsmandApplication app) { + this(app); + combineWithPoiFilters(filtersToMerge); + filterId = PoiUIFilter.STD_PREFIX + "combined"; + name = app.getPoiFilters().getFiltersName(filtersToMerge); + } + public String getFilterByName() { return filterByName; } @@ -494,6 +501,12 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable poiAdditionals.putAll(f.poiAdditionals); } + public void combineWithPoiFilters(Set filters) { + for (PoiUIFilter f : filters) { + combineWithPoiFilter(f); + } + } + public static void combineStandardPoiFilters(Set filters, OsmandApplication app) { Set standardFilters = new TreeSet<>(); for (PoiUIFilter filter : filters) { @@ -503,16 +516,7 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable } } if (!standardFilters.isEmpty()) { - PoiUIFilter standardFiltersCombined = null; - for (PoiUIFilter f : standardFilters) { - if (standardFiltersCombined == null) { - standardFiltersCombined = f; - f.filterId = PoiUIFilter.STD_PREFIX + "combined"; - f.name = app.getPoiFilters().getFiltersName(standardFilters); - } else { - standardFiltersCombined.combineWithPoiFilter(f); - } - } + PoiUIFilter standardFiltersCombined = new PoiUIFilter(standardFilters, app); filters.removeAll(standardFilters); filters.add(standardFiltersCombined); }